@Test public void testGetNativeType() { assertThat(getNativeType(TypeName.get(Address.class)), equalTo(TypeName.get(String.class))); assertThat(getNativeType(TypeName.get(Uint256.class)), equalTo(TypeName.get(BigInteger.class))); assertThat(getNativeType(TypeName.get(Int256.class)), equalTo(TypeName.get(BigInteger.class))); assertThat(getNativeType(TypeName.get(Utf8String.class)), equalTo(TypeName.get(String.class))); assertThat(getNativeType(TypeName.get(Bool.class)), equalTo(TypeName.get(Boolean.class))); assertThat(getNativeType(TypeName.get(Bytes32.class)), equalTo(TypeName.get(byte[].class))); assertThat(getNativeType(TypeName.get(DynamicBytes.class)), equalTo(TypeName.get(byte[].class))); }
static TypeName getNativeType(TypeName typeName) { if (typeName instanceof ParameterizedTypeName) { return getNativeType((ParameterizedTypeName) typeName); } String simpleName = ((ClassName) typeName).simpleName(); if (simpleName.equals(Address.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Uint")) { return TypeName.get(BigInteger.class); } else if (simpleName.startsWith("Int")) { return TypeName.get(BigInteger.class); } else if (simpleName.equals(Utf8String.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Bytes")) { return TypeName.get(byte[].class); } else if (simpleName.equals(DynamicBytes.class.getSimpleName())) { return TypeName.get(byte[].class); } else if (simpleName.equals(Bool.class.getSimpleName())) { return TypeName.get(Boolean.class); } else { throw new UnsupportedOperationException( "Unsupported type: " + typeName + ", no native type mapping exists."); } }
SolidityFunctionWrapper extends Generator { static TypeName getNativeType(TypeName typeName) { if (typeName instanceof ParameterizedTypeName) { return getNativeType((ParameterizedTypeName) typeName); } String simpleName = ((ClassName) typeName).simpleName(); if (simpleName.equals(Address.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Uint")) { return TypeName.get(BigInteger.class); } else if (simpleName.startsWith("Int")) { return TypeName.get(BigInteger.class); } else if (simpleName.equals(Utf8String.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Bytes")) { return TypeName.get(byte[].class); } else if (simpleName.equals(DynamicBytes.class.getSimpleName())) { return TypeName.get(byte[].class); } else if (simpleName.equals(Bool.class.getSimpleName())) { return TypeName.get(Boolean.class); } else { throw new UnsupportedOperationException( "Unsupported type: " + typeName + ", no native type mapping exists."); } } }
SolidityFunctionWrapper extends Generator { static TypeName getNativeType(TypeName typeName) { if (typeName instanceof ParameterizedTypeName) { return getNativeType((ParameterizedTypeName) typeName); } String simpleName = ((ClassName) typeName).simpleName(); if (simpleName.equals(Address.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Uint")) { return TypeName.get(BigInteger.class); } else if (simpleName.startsWith("Int")) { return TypeName.get(BigInteger.class); } else if (simpleName.equals(Utf8String.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Bytes")) { return TypeName.get(byte[].class); } else if (simpleName.equals(DynamicBytes.class.getSimpleName())) { return TypeName.get(byte[].class); } else if (simpleName.equals(Bool.class.getSimpleName())) { return TypeName.get(Boolean.class); } else { throw new UnsupportedOperationException( "Unsupported type: " + typeName + ", no native type mapping exists."); } } SolidityFunctionWrapper(boolean useNativeJavaTypes);   SolidityFunctionWrapper(boolean useNativeJavaTypes, GenerationReporter reporter); }
SolidityFunctionWrapper extends Generator { static TypeName getNativeType(TypeName typeName) { if (typeName instanceof ParameterizedTypeName) { return getNativeType((ParameterizedTypeName) typeName); } String simpleName = ((ClassName) typeName).simpleName(); if (simpleName.equals(Address.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Uint")) { return TypeName.get(BigInteger.class); } else if (simpleName.startsWith("Int")) { return TypeName.get(BigInteger.class); } else if (simpleName.equals(Utf8String.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Bytes")) { return TypeName.get(byte[].class); } else if (simpleName.equals(DynamicBytes.class.getSimpleName())) { return TypeName.get(byte[].class); } else if (simpleName.equals(Bool.class.getSimpleName())) { return TypeName.get(Boolean.class); } else { throw new UnsupportedOperationException( "Unsupported type: " + typeName + ", no native type mapping exists."); } } SolidityFunctionWrapper(boolean useNativeJavaTypes);   SolidityFunctionWrapper(boolean useNativeJavaTypes, GenerationReporter reporter); @SuppressWarnings("unchecked") void generateJavaFiles(
            String contractName, String bin, String abi, String destinationDir,
            String basePackageName); }
SolidityFunctionWrapper extends Generator { static TypeName getNativeType(TypeName typeName) { if (typeName instanceof ParameterizedTypeName) { return getNativeType((ParameterizedTypeName) typeName); } String simpleName = ((ClassName) typeName).simpleName(); if (simpleName.equals(Address.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Uint")) { return TypeName.get(BigInteger.class); } else if (simpleName.startsWith("Int")) { return TypeName.get(BigInteger.class); } else if (simpleName.equals(Utf8String.class.getSimpleName())) { return TypeName.get(String.class); } else if (simpleName.startsWith("Bytes")) { return TypeName.get(byte[].class); } else if (simpleName.equals(DynamicBytes.class.getSimpleName())) { return TypeName.get(byte[].class); } else if (simpleName.equals(Bool.class.getSimpleName())) { return TypeName.get(Boolean.class); } else { throw new UnsupportedOperationException( "Unsupported type: " + typeName + ", no native type mapping exists."); } } SolidityFunctionWrapper(boolean useNativeJavaTypes);   SolidityFunctionWrapper(boolean useNativeJavaTypes, GenerationReporter reporter); @SuppressWarnings("unchecked") void generateJavaFiles(
            String contractName, String bin, String abi, String destinationDir,
            String basePackageName);  }