/** * Returns the encoded string representing the object type signature. */ public String encode() { StringBuffer sb = new StringBuffer(); encode(sb); return sb.toString(); } }
/** * Returns the encoded string representing the object type signature. */ public String encode() { StringBuffer sb = new StringBuffer(); encode(sb); return sb.toString(); } }
/** * Returns the encoded string representing the object type signature. */ public String encode() { StringBuffer sb = new StringBuffer(); encode(sb); return sb.toString(); } }
static void encode(StringBuffer sb, TypeArgument[] args) { sb.append('<'); for (int i = 0; i < args.length; i++) { TypeArgument ta = args[i]; if (ta.isWildcard()) sb.append(ta.wildcard); if (ta.getType() != null) ta.getType().encode(sb); } sb.append('>'); } }
public static String getSignature(SignatureAttribute.Type type) { if (type instanceof SignatureAttribute.ObjectType) { return ((SignatureAttribute.ObjectType) type).encode(); } else if(type instanceof SignatureAttribute.BaseType){ return String.valueOf(((SignatureAttribute.BaseType) type).getDescriptor()); } return null; }
/** * Returns the encoded string representing the object type signature. */ public String encode() { StringBuffer sb = new StringBuffer(); encode(sb); return sb.toString(); } }
/** * Returns the encoded string representing the object type signature. */ public String encode() { StringBuffer sb = new StringBuffer(); encode(sb); return sb.toString(); } }
static void encode(StringBuffer sb, TypeArgument[] args) { sb.append('<'); for (int i = 0; i < args.length; i++) { TypeArgument ta = args[i]; if (ta.isWildcard()) sb.append(ta.wildcard); if (ta.getType() != null) ta.getType().encode(sb); } sb.append('>'); } }
static void encode(StringBuffer sb, TypeArgument[] args) { sb.append('<'); for (int i = 0; i < args.length; i++) { TypeArgument ta = args[i]; if (ta.isWildcard()) sb.append(ta.wildcard); if (ta.getType() != null) ta.getType().encode(sb); } sb.append('>'); } }
/** * Returns the encoded string representing the method type signature. */ public String encode() { StringBuffer sbuf = new StringBuffer(); if (typeParams.length > 0) { sbuf.append('<'); for (int i = 0; i < typeParams.length; i++) typeParams[i].encode(sbuf); sbuf.append('>'); } sbuf.append('('); for (int i = 0; i < params.length; i++) params[i].encode(sbuf); sbuf.append(')'); retType.encode(sbuf); if (exceptions.length > 0) for (int i = 0; i < exceptions.length; i++) { sbuf.append('^'); exceptions[i].encode(sbuf); } return sbuf.toString(); } }
private void ensureVersion(CtClass cc) throws NotFoundException, CannotCompileException, BadBytecode { CtMethod ccms[] = cc.getDeclaredMethods(); if (!javassist.Modifier.isAbstract(cc.getModifiers())) { String gsig = cc.getGenericSignature(); ClassSignature csig = SignatureAttribute.toClassSignature(gsig); // Warning: this is not doing proper parent (superclass/interfaces) traversal TypeArgument ta = getTypeArg(csig.getSuperClass().getTypeArguments(), "Lwater/api/rest/Version"); if (ta!=null && !hasExisting("getVersion", "()"+ta.getType().encode(), ccms) ) { String typeName = ta.toString(); String valueName = getValueFromType(typeName); //cc.addMethod(CtNewMethod.make("public "+typeName+" getVersion() {" + cc.addMethod(CtNewMethod.make("public water.api.rest.Version getVersion() {" + " return "+valueName+";" + "}",cc)); } } } private String getValueFromType(String typeName) {
/** * Returns the encoded string representing the method type signature. */ public String encode() { StringBuffer sbuf = new StringBuffer(); if (typeParams.length > 0) { sbuf.append('<'); for (int i = 0; i < typeParams.length; i++) typeParams[i].encode(sbuf); sbuf.append('>'); } sbuf.append('('); for (int i = 0; i < params.length; i++) params[i].encode(sbuf); sbuf.append(')'); retType.encode(sbuf); if (exceptions.length > 0) for (int i = 0; i < exceptions.length; i++) { sbuf.append('^'); exceptions[i].encode(sbuf); } return sbuf.toString(); } }
static void encode(StringBuffer sb, TypeArgument[] args) { sb.append('<'); for (int i = 0; i < args.length; i++) { TypeArgument ta = args[i]; if (ta.isWildcard()) sb.append(ta.wildcard); if (ta.getType() != null) ta.getType().encode(sb); } sb.append('>'); } }
private TypeArgument getTypeArg(TypeArgument[] args, String prefix) { for (TypeArgument ta : args) if (ta.getType().encode().startsWith(prefix)) return ta; return null; }
static void encode(StringBuffer sb, TypeArgument[] args) { sb.append('<'); for (int i = 0; i < args.length; i++) { TypeArgument ta = args[i]; if (ta.isWildcard()) sb.append(ta.wildcard); if (ta.getType() != null) ta.getType().encode(sb); } sb.append('>'); } }