/** * Is invoked when public fields of the base-level * class are modified and the runtime system intercepts it. * This method simply sets the field to the given value. * * <p>Every subclass of this class should redefine this method. */ public void trapFieldWrite(String name, Object value) { Class jc = getClassMetaobject().getJavaClass(); try { jc.getField(name).set(getObject(), value); } catch (NoSuchFieldException e) { throw new RuntimeException(e.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e.toString()); } }
public static Object trapRead(Object[] args, String name) { if (args[0] == null) return _classobject.trapFieldRead(name); else return ((Metalevel)args[0])._getMetaobject().trapFieldRead(name); }
public static Object trapWrite(Object[] args, String name) { Metalevel base = (Metalevel)args[0]; if (base == null) _classobject.trapFieldWrite(name, args[1]); else base._getMetaobject().trapFieldWrite(name, args[1]); return null; } }
public Object trap(Object[] args, int identifier) throws Throwable { Metaobject mobj; mobj = _metaobject; if (mobj == null) return ClassMetaobject.invoke(this, identifier, args); else return mobj.trapMethodcall(identifier, args); }
return methods[identifier].invoke(getObject(), args);
public Object trap(Object[] args, int identifier) throws Throwable { Metaobject mobj; mobj = _metaobject; if (mobj == null) return ClassMetaobject.invoke(this, identifier, args); return mobj.trapMethodcall(identifier, args); }
return methods[identifier].invoke(getObject(), args);
/** * Is invoked when public fields of the base-level * class are read and the runtime system intercepts it. * This method simply returns the value of the field. * * <p>Every subclass of this class should redefine this method. */ public Object trapFieldRead(String name) { Class jc = getClassMetaobject().getJavaClass(); try { return jc.getField(name).get(getObject()); } catch (NoSuchFieldException e) { throw new RuntimeException(e.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e.toString()); } }
public static Object trapWrite(Object[] args, String name) { Metalevel base = (Metalevel)args[0]; if (base == null) _classobject.trapFieldWrite(name, args[1]); else base._getMetaobject().trapFieldWrite(name, args[1]); return null; } }
public Object trap(Object[] args, int identifier) throws Throwable { Metaobject mobj; mobj = _metaobject; if (mobj == null) return ClassMetaobject.invoke(this, identifier, args); else return mobj.trapMethodcall(identifier, args); }
public static Object trapRead(Object[] args, String name) { if (args[0] == null) return _classobject.trapFieldRead(name); return ((Metalevel)args[0])._getMetaobject().trapFieldRead(name); }
return methods[identifier].invoke(getObject(), args);
/** * Is invoked when public fields of the base-level * class are read and the runtime system intercepts it. * This method simply returns the value of the field. * * <p>Every subclass of this class should redefine this method. */ public Object trapFieldRead(String name) { Class<?> jc = getClassMetaobject().getJavaClass(); try { return jc.getField(name).get(getObject()); } catch (NoSuchFieldException e) { throw new RuntimeException(e.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e.toString()); } }
public static Object trapWrite(Object[] args, String name) { Metalevel base = (Metalevel)args[0]; if (base == null) _classobject.trapFieldWrite(name, args[1]); else base._getMetaobject().trapFieldWrite(name, args[1]); return null; } }
public Object trap(Object[] args, int identifier) throws Throwable { Metaobject mobj; mobj = _metaobject; if (mobj == null) return ClassMetaobject.invoke(this, identifier, args); else return mobj.trapMethodcall(identifier, args); }
public static Object trapRead(Object[] args, String name) { if (args[0] == null) return _classobject.trapFieldRead(name); else return ((Metalevel)args[0])._getMetaobject().trapFieldRead(name); }
return methods[identifier].invoke(getObject(), args);
/** * Is invoked when public fields of the base-level * class are modified and the runtime system intercepts it. * This method simply sets the field to the given value. * * <p>Every subclass of this class should redefine this method. */ public void trapFieldWrite(String name, Object value) { Class<?> jc = getClassMetaobject().getJavaClass(); try { jc.getField(name).set(getObject(), value); } catch (NoSuchFieldException e) { throw new RuntimeException(e.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e.toString()); } }
public static Object trapWrite(Object[] args, String name) { Metalevel base = (Metalevel)args[0]; if (base == null) _classobject.trapFieldWrite(name, args[1]); else base._getMetaobject().trapFieldWrite(name, args[1]); return null; } }
public Object trap(Object[] args, int identifier) throws Throwable { Metaobject mobj; mobj = _metaobject; if (mobj == null) return ClassMetaobject.invoke(this, identifier, args); else return mobj.trapMethodcall(identifier, args); }