use of net.sf.cglib.asm.Type in project simplejpa by appoxy.
the class LazyInterceptor method handleSetMethod.
private void handleSetMethod(Object obj, Method method, Object[] args) throws Throwable {
// we basically want to mark this object as dirty if this is called and to only delete attributes if it's dirty
dirty = true;
String attributeName = NamingHelper.attributeName(method);
if (args != null && args.length == 1) {
Object valueToSet = args[0];
if (valueToSet == null) {
// FIXME support direct field accessors better here
PersistentMethod persistentMethod = (PersistentMethod) (PersistentMethod) em.getFactory().getAnnotationManager().getAnnotationInfo(obj).getPersistentProperty(attributeName);
Method getter = persistentMethod.getGetter();
MethodProxy getterProxy = MethodProxy.find(obj.getClass(), new Signature(persistentMethod.getGetter().getName(), Type.getType(getter.getReturnType()), new Type[] {}));
Object ret = getterProxy.invokeSuper(obj, null);
if (ret != null) {
nulledFields.put(attributeName, ret);
logger.fine("field " + attributeName + " is being nulled. Old value = " + ret);
}
}
}
}
Aggregations