MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
/** * Produces codes in which a new object is created and assigned to * the field as the initial value. */ int compile(CtClass type, String name, Bytecode code, CtClass[] parameters, Javac drv) throws CannotCompileException { int stacksize; code.addAload(0); code.addAload(0); if (stringParams == null) stacksize = 2; else stacksize = compileStringParameter(code) + 2; if (withConstructorParams) stacksize += CtNewWrappedMethod.compileParameterList(code, parameters, 1); String typeDesc = Descriptor.of(type); String mDesc = getDescriptor() + typeDesc; code.addInvokestatic(objectType, methodName, mDesc); code.addPutfield(Bytecode.THIS, name, typeDesc); return stacksize; }
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
String methodName, String[] stringParams) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
String methodName, String[] stringParams) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
String methodName, String[] stringParams) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
String methodName, String[] stringParams) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
String methodName, String[] stringParams) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName;
/** * Makes an initializer calling a static method. * * <p>This initializer calls a static method and uses the returned * value as the initial value of the field. * The called method receives the parameters: * * <ul><code>Object obj</code> - the object including the field.<br> * </ul> * * <p>If the initialized field is static, then the method does * not receive any parameters. * * <p>The type of the returned value must be the same as the field * type. * * @param methodClass the class that the static method is * declared in. * @param methodName the name of the satic method. */ public static Initializer byCall(CtClass methodClass, String methodName) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName; i.stringParams = null; i.withConstructorParams = false; return i; }
/** * Makes an initializer calling a static method. * * <p>This initializer calls a static method and uses the returned * value as the initial value of the field. * The called method receives the parameters: * * <ul><code>Object obj</code> - the object including the field.<br> * </ul> * * <p>If the initialized field is static, then the method does * not receive any parameters. * * <p>The type of the returned value must be the same as the field * type. * * @param methodClass the class that the static method is * declared in. * @param methodName the name of the satic method. */ public static Initializer byCall(CtClass methodClass, String methodName) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName; i.stringParams = null; i.withConstructorParams = false; return i; }
/** * Makes an initializer calling a static method. * * <p>This initializer calls a static method and uses the returned * value as the initial value of the field. * The called method receives the parameters: * * <ul><code>Object obj</code> - the object including the field.<br> * </ul> * * <p>If the initialized field is static, then the method does * not receive any parameters. * * <p>The type of the returned value must be the same as the field * type. * * @param methodClass the class that the static method is * declared in. * @param methodName the name of the satic method. */ public static Initializer byCall(CtClass methodClass, String methodName) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName; i.stringParams = null; i.withConstructorParams = false; return i; }
/** * Makes an initializer calling a static method. * * <p>This initializer calls a static method and uses the returned * value as the initial value of the field. * The called method receives the parameters: * * <ul><code>Object obj</code> - the object including the field.<br> * </ul> * * <p>If the initialized field is static, then the method does * not receive any parameters. * * <p>The type of the returned value must be the same as the field * type. * * @param methodClass the class that the static method is * declared in. * @param methodName the name of the satic method. */ public static Initializer byCall(CtClass methodClass, String methodName) { MethodInitializer i = new MethodInitializer(); i.objectType = methodClass; i.methodName = methodName; i.stringParams = null; i.withConstructorParams = false; return i; }