|
|
|
@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.property.access.spi;
|
|
|
|
|
|
|
|
|
|
import com.fr.third.org.hibernate.engine.spi.SessionImplementor; |
|
|
|
|
import com.fr.third.org.hibernate.property.access.internal.AbstractFieldSerialForm; |
|
|
|
|
import sun.misc.Unsafe; |
|
|
|
|
import sun.reflect.FieldAccessor; |
|
|
|
|
import sun.reflect.ReflectionFactory; |
|
|
|
|
//import sun.misc.Unsafe;
|
|
|
|
|
//import sun.reflect.FieldAccessor;
|
|
|
|
|
//import sun.reflect.ReflectionFactory;
|
|
|
|
|
|
|
|
|
|
import java.io.ObjectStreamException; |
|
|
|
|
import java.io.Serializable; |
|
|
|
@ -31,11 +31,11 @@ public class UnsafeGetterFieldImpl implements Getter {
|
|
|
|
|
private final Class containerClass; |
|
|
|
|
private final String propertyName; |
|
|
|
|
private final Field field; |
|
|
|
|
private final FieldAccessor accessor; |
|
|
|
|
// private final FieldAccessor accessor;
|
|
|
|
|
|
|
|
|
|
static ReflectionFactory reflectionFactory = |
|
|
|
|
AccessController.doPrivileged( |
|
|
|
|
new sun.reflect.ReflectionFactory.GetReflectionFactoryAction()); |
|
|
|
|
// static ReflectionFactory reflectionFactory =
|
|
|
|
|
// AccessController.doPrivileged(
|
|
|
|
|
// new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -44,14 +44,14 @@ public class UnsafeGetterFieldImpl implements Getter {
|
|
|
|
|
this.containerClass = containerClass; |
|
|
|
|
this.propertyName = propertyName; |
|
|
|
|
this.field = field; |
|
|
|
|
accessor = reflectionFactory.newFieldAccessor(field, false); |
|
|
|
|
// accessor = reflectionFactory.newFieldAccessor(field, false);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object get(Object owner) { |
|
|
|
|
if(accessor != null){ |
|
|
|
|
return accessor.get(owner); |
|
|
|
|
} |
|
|
|
|
// if(accessor != null){
|
|
|
|
|
// return accessor.get(owner);
|
|
|
|
|
// }
|
|
|
|
|
try { |
|
|
|
|
return field.get( owner ); |
|
|
|
|
} |
|
|
|
|