/******************************************************************************* | |
* Copyright (c) 2020 RBEI and others. | |
* | |
* This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v. 2.0 | |
* which accompanies this distribution, and is available at | |
* https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* SPDX-License-Identifier: EPL-2.0 | |
* | |
* Contributors: | |
* Adhith Gopal - Initial API and Implementation | |
*******************************************************************************/ | |
package org.eclipse.blockchain.core; | |
/** | |
* Wrapper class for SolidityDynamicValueCaster | |
*/ | |
public class SolidityDynamicValueCasterHandler { | |
private SolidityDynamicValueCasterHandler() { | |
} | |
/** | |
* @param valueToCast | |
* - | |
* @param actualType | |
* - | |
* @param isArray | |
* - | |
* @return - | |
*/ | |
public static Object getValue(final String valueToCast, | |
final Class<?> actualType, final boolean isArray) { | |
if (isArray) { | |
return SolidityDynamicValueCaster.castArrayArgs(valueToCast, | |
actualType); | |
} | |
if ((actualType.getComponentType() != null) && "byte" | |
.equals(actualType.getComponentType().toGenericString())) { | |
return SolidityDynamicValueCaster.getByteArray(valueToCast); | |
} | |
return SolidityDynamicValueCaster.castValue(valueToCast, actualType); | |
} | |
} |