@Test public void testFunctionSimpleEncode() { Function function = new Function( "baz", Arrays.asList(new Uint32(BigInteger.valueOf(69)), new Bool(true)), Collections.<TypeReference<?>>emptyList() ); assertThat(FunctionEncoder.encode(function), is("0xcdcd77c0" + "0000000000000000000000000000000000000000000000000000000000000045" + "0000000000000000000000000000000000000000000000000000000000000001" )); }
public static String encode(Function function) { List<Type> parameters = function.getInputParameters(); String methodSignature = buildMethodSignature(function.getName(), parameters); String methodId = buildMethodId(methodSignature); StringBuilder result = new StringBuilder(); result.append(methodId); return encodeParameters(parameters, result); }
FunctionEncoder { public static String encode(Function function) { List<Type> parameters = function.getInputParameters(); String methodSignature = buildMethodSignature(function.getName(), parameters); String methodId = buildMethodId(methodSignature); StringBuilder result = new StringBuilder(); result.append(methodId); return encodeParameters(parameters, result); } }
FunctionEncoder { public static String encode(Function function) { List<Type> parameters = function.getInputParameters(); String methodSignature = buildMethodSignature(function.getName(), parameters); String methodId = buildMethodId(methodSignature); StringBuilder result = new StringBuilder(); result.append(methodId); return encodeParameters(parameters, result); } private  FunctionEncoder(); }
FunctionEncoder { public static String encode(Function function) { List<Type> parameters = function.getInputParameters(); String methodSignature = buildMethodSignature(function.getName(), parameters); String methodId = buildMethodId(methodSignature); StringBuilder result = new StringBuilder(); result.append(methodId); return encodeParameters(parameters, result); } private  FunctionEncoder(); static String encode(Function function); static String encodeConstructor(List<Type> parameters); static String buildMethodId(String methodSignature); }
FunctionEncoder { public static String encode(Function function) { List<Type> parameters = function.getInputParameters(); String methodSignature = buildMethodSignature(function.getName(), parameters); String methodId = buildMethodId(methodSignature); StringBuilder result = new StringBuilder(); result.append(methodId); return encodeParameters(parameters, result); } private  FunctionEncoder(); static String encode(Function function); static String encodeConstructor(List<Type> parameters); static String buildMethodId(String methodSignature);  }