< prev index next >

src/java.base/share/classes/java/lang/reflect/ReflectAccess.java

Print this page




 148     }
 149 
 150     public Field       copyField(Field arg) {
 151         return arg.copy();
 152     }
 153 
 154     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 155         return arg.copy();
 156     }
 157 
 158     @SuppressWarnings("unchecked")
 159     public <T extends AccessibleObject> T getRoot(T obj) {
 160         return (T) obj.getRoot();
 161     }
 162 
 163     public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
 164         throws IllegalAccessException, InstantiationException, InvocationTargetException
 165     {
 166         return ctor.newInstanceWithCaller(args, true, caller);
 167     }
 168     /*
 169      * With a Field object for C.f of type T, T should have been resolved
 170      * and T must be present in ValueType attribute.
 171      */
 172     public boolean isFlattenable(Field f) {
 173         return (f.getModifiers() & Modifier.FLATTENABLE) == Modifier.FLATTENABLE;
 174     }
 175 
 176     public boolean isFlatValue(Field f) {
 177         return (f.getModifiers() & Modifier.FLATTENED) == Modifier.FLATTENED;
 178     }
 179 
 180     public boolean canBeNull(Field f) {
 181         return !isFlattenable(f);
 182     }
 183 }


 148     }
 149 
 150     public Field       copyField(Field arg) {
 151         return arg.copy();
 152     }
 153 
 154     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 155         return arg.copy();
 156     }
 157 
 158     @SuppressWarnings("unchecked")
 159     public <T extends AccessibleObject> T getRoot(T obj) {
 160         return (T) obj.getRoot();
 161     }
 162 
 163     public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
 164         throws IllegalAccessException, InstantiationException, InvocationTargetException
 165     {
 166         return ctor.newInstanceWithCaller(args, true, caller);
 167     }















 168 }
< prev index next >