@Test public void testBuildTypeName() { assertThat(buildTypeName("uint256"), is(ClassName.get(Uint256.class))); assertThat(buildTypeName("uint64"), is(ClassName.get(Uint64.class))); assertThat(buildTypeName("string"), is(ClassName.get(Utf8String.class))); assertThat(buildTypeName("uint256[]"), is(ParameterizedTypeName.get(DynamicArray.class, Uint256.class))); assertThat(buildTypeName("uint256[] storage"), is(ParameterizedTypeName.get(DynamicArray.class, Uint256.class))); assertThat(buildTypeName("uint256[] memory"), is(ParameterizedTypeName.get(DynamicArray.class, Uint256.class))); assertThat(buildTypeName("uint256[10]"), is(ParameterizedTypeName.get(StaticArray10.class, Uint256.class))); assertThat(buildTypeName("uint256[33]"), is(ParameterizedTypeName.get(StaticArray.class, Uint256.class))); }
static TypeName buildTypeName(String typeDeclaration) { String type = trimStorageDeclaration(typeDeclaration); if (type.endsWith("]")) { String[] splitType = type.split("[\\[\\]]"); Class<?> baseType = AbiTypes.getType(splitType[0]); TypeName typeName; if (splitType.length == 1) { typeName = ParameterizedTypeName.get(DynamicArray.class, baseType); } else { Class<?> rawType = getStaticArrayTypeReferenceClass(splitType); typeName = ParameterizedTypeName.get(rawType, baseType); } return typeName; } else { Class<?> cls = AbiTypes.getType(type); return ClassName.get(cls); } }
SolidityFunctionWrapper extends Generator { static TypeName buildTypeName(String typeDeclaration) { String type = trimStorageDeclaration(typeDeclaration); if (type.endsWith("]")) { String[] splitType = type.split("[\\[\\]]"); Class<?> baseType = AbiTypes.getType(splitType[0]); TypeName typeName; if (splitType.length == 1) { typeName = ParameterizedTypeName.get(DynamicArray.class, baseType); } else { Class<?> rawType = getStaticArrayTypeReferenceClass(splitType); typeName = ParameterizedTypeName.get(rawType, baseType); } return typeName; } else { Class<?> cls = AbiTypes.getType(type); return ClassName.get(cls); } } }
SolidityFunctionWrapper extends Generator { static TypeName buildTypeName(String typeDeclaration) { String type = trimStorageDeclaration(typeDeclaration); if (type.endsWith("]")) { String[] splitType = type.split("[\\[\\]]"); Class<?> baseType = AbiTypes.getType(splitType[0]); TypeName typeName; if (splitType.length == 1) { typeName = ParameterizedTypeName.get(DynamicArray.class, baseType); } else { Class<?> rawType = getStaticArrayTypeReferenceClass(splitType); typeName = ParameterizedTypeName.get(rawType, baseType); } return typeName; } else { Class<?> cls = AbiTypes.getType(type); return ClassName.get(cls); } } SolidityFunctionWrapper(boolean useNativeJavaTypes); }
SolidityFunctionWrapper extends Generator { static TypeName buildTypeName(String typeDeclaration) { String type = trimStorageDeclaration(typeDeclaration); if (type.endsWith("]")) { String[] splitType = type.split("[\\[\\]]"); Class<?> baseType = AbiTypes.getType(splitType[0]); TypeName typeName; if (splitType.length == 1) { typeName = ParameterizedTypeName.get(DynamicArray.class, baseType); } else { Class<?> rawType = getStaticArrayTypeReferenceClass(splitType); typeName = ParameterizedTypeName.get(rawType, baseType); } return typeName; } else { Class<?> cls = AbiTypes.getType(type); return ClassName.get(cls); } } SolidityFunctionWrapper(boolean useNativeJavaTypes); @SuppressWarnings("unchecked") void generateJavaFiles(
            String contractName, String bin, String abi, String destinationDir,
            String basePackageName); }
SolidityFunctionWrapper extends Generator { static TypeName buildTypeName(String typeDeclaration) { String type = trimStorageDeclaration(typeDeclaration); if (type.endsWith("]")) { String[] splitType = type.split("[\\[\\]]"); Class<?> baseType = AbiTypes.getType(splitType[0]); TypeName typeName; if (splitType.length == 1) { typeName = ParameterizedTypeName.get(DynamicArray.class, baseType); } else { Class<?> rawType = getStaticArrayTypeReferenceClass(splitType); typeName = ParameterizedTypeName.get(rawType, baseType); } return typeName; } else { Class<?> cls = AbiTypes.getType(type); return ClassName.get(cls); } } SolidityFunctionWrapper(boolean useNativeJavaTypes); @SuppressWarnings("unchecked") void generateJavaFiles(
            String contractName, String bin, String abi, String destinationDir,
            String basePackageName);  }