Refine search
private void emitSetStaticCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_STATIC, SET_STATIC_CALLBACKS, null); e.load_arg(0); e.putfield(STATIC_CALLBACKS_FIELD); e.return_value(); e.end_method(); }
private void setByIndex(final String[] names, final int[] indexes) throws Exception { final CodeEmitter e = super.begin_method(Constants.ACC_PUBLIC, PROVIDER_SET_BY_INDEX, null); e.load_this(); e.load_arg(1); e.load_arg(0); e.process_switch(indexes, new ProcessSwitchCallback() { public void processCase(int key, Label end) throws Exception { Type type = (Type)fields.get(names[key]); e.unbox(type); e.putfield(names[key]); e.return_value(); } public void processDefault() throws Exception { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Unknown field index"); } }); e.end_method(); }
public void processCase(Object key, Label end) { PropertyDescriptor pd = (PropertyDescriptor)setters.get(key); if (pd.getReadMethod() == null) { e.aconst_null(); } else { MethodInfo read = ReflectUtils.getMethodInfo(pd.getReadMethod()); e.dup(); e.invoke(read); e.box(read.getSignature().getReturnType()); } e.swap(); // move old value behind bean e.load_arg(2); // new value MethodInfo write = ReflectUtils.getMethodInfo(pd.getWriteMethod()); e.unbox(write.getSignature().getArgumentTypes()[0]); e.invoke(write); e.return_value(); } public void processDefault() {
e.load_args(); e.super_invoke_constructor(CSTRUCT_CLASS); e.return_value(); e.end_method(); List info = CollectionUtils.transform(constructors, MethodInfoTransformer.getInstance()); EmitUtils.constructor_switch(e, info, new GetIndexCallback(e, info)); e.end_method(); e.load_arg(1); e.checkcast(base); e.load_arg(0); invokeSwitchHelper(e, methods, 2, base); e.end_method(); e.new_instance(base); e.dup(); e.load_arg(0); invokeSwitchHelper(e, constructors, 1, base); e.end_method(); e.return_value(); e.end_method();
private void emitSetStaticCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_STATIC, SET_STATIC_CALLBACKS, null); e.load_arg(0); e.putfield(STATIC_CALLBACKS_FIELD); e.return_value(); e.end_method(); }
e.load_args(); e.super_invoke_constructor(CSTRUCT_CLASS); e.return_value(); e.end_method(); List info = CollectionUtils.transform(constructors, MethodInfoTransformer.getInstance()); EmitUtils.constructor_switch(e, info, new GetIndexCallback(e, info)); e.end_method(); e.load_arg(1); e.checkcast(base); e.load_arg(0); invokeSwitchHelper(e, methods, 2, base); e.end_method(); e.new_instance(base); e.dup(); e.load_arg(0); invokeSwitchHelper(e, constructors, 1, base); e.end_method(); e.return_value(); e.end_method();
private void setField(String[] names) throws Exception { final CodeEmitter e = begin_method(Constants.ACC_PUBLIC, PROVIDER_SET, null); e.load_this(); e.load_arg(1); e.load_arg(0); EmitUtils.string_switch(e, names, Constants.SWITCH_STYLE_HASH, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { Type type = (Type)fields.get(key); e.unbox(type); e.putfield((String)key); e.return_value(); } public void processDefault() { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Unknown field name"); } }); e.end_method(); } }
public void processCase(int key, Label end) { MethodInfo method = (MethodInfo)info.get(key); Type[] types = method.getSignature().getArgumentTypes(); for (int i = 0; i < types.length; i++) { e.load_arg(arg); e.aaload(i); e.unbox(types[i]); } // TODO: change method lookup process so MethodInfo will already reference base // instead of superclass when superclass method is inaccessible e.invoke(method, base); if (!TypeUtils.isConstructor(method)) { e.box(method.getSignature().getReturnType()); } e.return_value(); } public void processDefault() {
private void generateConstructor() { CodeEmitter e = begin_method(Constants.ACC_PUBLIC, CSTRUCT_OBJECT, null); e.load_this(); e.load_arg(0); e.super_invoke_constructor(CSTRUCT_OBJECT); e.return_value(); e.end_method(); }
e.load_args(); e.invoke(methodInfo); e.return_value(); e.end_method(); e.getfield("eqMethod"); e.super_putfield("eqMethod", Constants.TYPE_STRING); e.load_arg(0); e.super_putfield("target", Constants.TYPE_OBJECT); e.return_value(); e.end_method(); e.push(methodInfo.getSignature().toString()); e.putfield("eqMethod"); e.return_value(); e.end_method();
private void generateGetPropertyType(final Map allProps, String[] allNames) { final CodeEmitter e = begin_method(Constants.ACC_PUBLIC, GET_PROPERTY_TYPE, null); e.load_arg(0); EmitUtils.string_switch(e, allNames, Constants.SWITCH_STYLE_HASH, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { PropertyDescriptor pd = (PropertyDescriptor)allProps.get(key); EmitUtils.load_class(e, Type.getType(pd.getPropertyType())); e.return_value(); } public void processDefault() { e.aconst_null(); e.return_value(); } }); e.end_method(); } }
public void processCase(Object key, Label end) { PropertyDescriptor pd = (PropertyDescriptor)setters.get(key); if (pd.getReadMethod() == null) { e.aconst_null(); } else { MethodInfo read = ReflectUtils.getMethodInfo(pd.getReadMethod()); e.dup(); e.invoke(read); e.box(read.getSignature().getReturnType()); } e.swap(); // move old value behind bean e.load_arg(2); // new value MethodInfo write = ReflectUtils.getMethodInfo(pd.getWriteMethod()); e.unbox(write.getSignature().getArgumentTypes()[0]); e.invoke(write); e.return_value(); } public void processDefault() {
private void emitSetThreadCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_STATIC, SET_THREAD_CALLBACKS, null); e.getfield(THREAD_CALLBACKS_FIELD); e.load_arg(0); e.invoke_virtual(THREAD_LOCAL, THREAD_LOCAL_SET); e.return_value(); e.end_method(); }
e.load_args(); e.invoke(methodInfo); e.return_value(); e.end_method(); e.getfield("eqMethod"); e.super_putfield("eqMethod", Constants.TYPE_STRING); e.load_arg(0); e.super_putfield("target", Constants.TYPE_OBJECT); e.return_value(); e.end_method(); e.push(methodInfo.getSignature().toString()); e.putfield("eqMethod"); e.return_value(); e.end_method();
private void setField(String[] names) throws Exception { final CodeEmitter e = begin_method(Constants.ACC_PUBLIC, PROVIDER_SET, null); e.load_this(); e.load_arg(1); e.load_arg(0); EmitUtils.string_switch(e, names, Constants.SWITCH_STYLE_HASH, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { Type type = (Type)fields.get(key); e.unbox(type); e.putfield((String)key); e.return_value(); } public void processDefault() { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Unknown field name"); } }); e.end_method(); } }
public void processCase(int key, Label end) { MethodInfo method = (MethodInfo)info.get(key); Type[] types = method.getSignature().getArgumentTypes(); for (int i = 0; i < types.length; i++) { e.load_arg(arg); e.aaload(i); e.unbox(types[i]); } // TODO: change method lookup process so MethodInfo will already reference base // instead of superclass when superclass method is inaccessible e.invoke(method, base); if (!TypeUtils.isConstructor(method)) { e.box(method.getSignature().getReturnType()); } e.return_value(); } public void processDefault() {
private void emitSetCallback(ClassEmitter ce, int[] keys) { final CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, SET_CALLBACK, null); e.load_arg(0); e.process_switch(keys, new ProcessSwitchCallback() { public void processCase(int key, Label end) { e.load_this(); e.load_arg(1); e.checkcast(callbackTypes[key]); e.putfield(getCallbackField(key)); e.goTo(end); } public void processDefault() { // TODO: error? } }); e.return_value(); e.end_method(); }
e.super_invoke_constructor(); e.load_this(); e.load_arg(0); e.putfield(FIELD_NAME); e.return_value(); e.end_method(); e.load_args(); e.invoke(method); e.return_value(); e.end_method();
private void setByIndex(final String[] names, final int[] indexes) throws Exception { final CodeEmitter e = super.begin_method(Constants.ACC_PUBLIC, PROVIDER_SET_BY_INDEX, null); e.load_this(); e.load_arg(1); e.load_arg(0); e.process_switch(indexes, new ProcessSwitchCallback() { public void processCase(int key, Label end) throws Exception { Type type = (Type)fields.get(names[key]); e.unbox(type); e.putfield(names[key]); e.return_value(); } public void processDefault() throws Exception { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Unknown field index"); } }); e.end_method(); }
public void processCase(Object key, Label end) { PropertyDescriptor pd = (PropertyDescriptor)setters.get(key); if (pd.getReadMethod() == null) { e.aconst_null(); } else { MethodInfo read = ReflectUtils.getMethodInfo(pd.getReadMethod()); e.dup(); e.invoke(read); e.box(read.getSignature().getReturnType()); } e.swap(); // move old value behind bean e.load_arg(2); // new value MethodInfo write = ReflectUtils.getMethodInfo(pd.getWriteMethod()); e.unbox(write.getSignature().getArgumentTypes()[0]); e.invoke(write); e.return_value(); } public void processDefault() {