@Test public void testBuildMessageSignature() { assertThat( FunctionEncoder.buildMethodSignature( "baz", Arrays.<Type>asList( new Uint32(BigInteger.valueOf(69)), new Bool(true)) ), is("baz(uint32,bool)")); }
static String buildMethodSignature(String methodName, List<Type> parameters) { StringBuilder result = new StringBuilder(); result.append(methodName); result.append("("); List<String> types = new ArrayList<String>(parameters.size()); String params = ""; for (int i = 0; i < parameters.size(); i++) { Type type = parameters.get(i); params += type.getTypeAsString(); if (i + 1 < parameters.size()) { params += ","; } types.add(type.getTypeAsString()); } result.append(params); result.append(")"); return result.toString(); }
FunctionEncoder { static String buildMethodSignature(String methodName, List<Type> parameters) { StringBuilder result = new StringBuilder(); result.append(methodName); result.append("("); List<String> types = new ArrayList<String>(parameters.size()); String params = ""; for (int i = 0; i < parameters.size(); i++) { Type type = parameters.get(i); params += type.getTypeAsString(); if (i + 1 < parameters.size()) { params += ","; } types.add(type.getTypeAsString()); } result.append(params); result.append(")"); return result.toString(); } }
FunctionEncoder { static String buildMethodSignature(String methodName, List<Type> parameters) { StringBuilder result = new StringBuilder(); result.append(methodName); result.append("("); List<String> types = new ArrayList<String>(parameters.size()); String params = ""; for (int i = 0; i < parameters.size(); i++) { Type type = parameters.get(i); params += type.getTypeAsString(); if (i + 1 < parameters.size()) { params += ","; } types.add(type.getTypeAsString()); } result.append(params); result.append(")"); return result.toString(); } private  FunctionEncoder(); }
FunctionEncoder { static String buildMethodSignature(String methodName, List<Type> parameters) { StringBuilder result = new StringBuilder(); result.append(methodName); result.append("("); List<String> types = new ArrayList<String>(parameters.size()); String params = ""; for (int i = 0; i < parameters.size(); i++) { Type type = parameters.get(i); params += type.getTypeAsString(); if (i + 1 < parameters.size()) { params += ","; } types.add(type.getTypeAsString()); } result.append(params); result.append(")"); return result.toString(); } private  FunctionEncoder(); static String encode(Function function); static String encodeConstructor(List<Type> parameters); }
FunctionEncoder { static String buildMethodSignature(String methodName, List<Type> parameters) { StringBuilder result = new StringBuilder(); result.append(methodName); result.append("("); List<String> types = new ArrayList<String>(parameters.size()); String params = ""; for (int i = 0; i < parameters.size(); i++) { Type type = parameters.get(i); params += type.getTypeAsString(); if (i + 1 < parameters.size()) { params += ","; } types.add(type.getTypeAsString()); } result.append(params); result.append(")"); return result.toString(); } private  FunctionEncoder(); static String encode(Function function); static String encodeConstructor(List<Type> parameters);  }