< prev index next >

src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java

Print this page




 328     /** Makes a copy of the passed field. The returned field is a
 329         "child" of the passed one; see the comments in Field.java for
 330         details. */
 331     public Field copyField(Field arg) {
 332         return langReflectAccess().copyField(arg);
 333     }
 334 
 335     /** Makes a copy of the passed constructor. The returned
 336         constructor is a "child" of the passed one; see the comments
 337         in Constructor.java for details. */
 338     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 339         return langReflectAccess().copyConstructor(arg);
 340     }
 341 
 342     /** Gets the byte[] that encodes TypeAnnotations on an executable.
 343      */
 344     public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
 345         return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
 346     }
 347 




 348     //--------------------------------------------------------------------------
 349     //
 350     // Routines used by serialization
 351     //
 352     //
 353 
 354     public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
 355         if (!Externalizable.class.isAssignableFrom(cl)) {
 356             return null;
 357         }
 358         try {
 359             Constructor<?> cons = cl.getConstructor();
 360             cons.setAccessible(true);
 361             return cons;
 362         } catch (NoSuchMethodException ex) {
 363             return null;
 364         }
 365     }
 366 
 367     public final Constructor<?> newConstructorForSerialization(Class<?> cl,




 328     /** Makes a copy of the passed field. The returned field is a
 329         "child" of the passed one; see the comments in Field.java for
 330         details. */
 331     public Field copyField(Field arg) {
 332         return langReflectAccess().copyField(arg);
 333     }
 334 
 335     /** Makes a copy of the passed constructor. The returned
 336         constructor is a "child" of the passed one; see the comments
 337         in Constructor.java for details. */
 338     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 339         return langReflectAccess().copyConstructor(arg);
 340     }
 341 
 342     /** Gets the byte[] that encodes TypeAnnotations on an executable.
 343      */
 344     public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
 345         return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
 346     }
 347 
 348     public Class<?>[] getExecutableSharedParameterTypes(Executable ex) {
 349         return langReflectAccess().getExecutableSharedParameterTypes(ex);
 350     }
 351 
 352     //--------------------------------------------------------------------------
 353     //
 354     // Routines used by serialization
 355     //
 356     //
 357 
 358     public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
 359         if (!Externalizable.class.isAssignableFrom(cl)) {
 360             return null;
 361         }
 362         try {
 363             Constructor<?> cons = cl.getConstructor();
 364             cons.setAccessible(true);
 365             return cons;
 366         } catch (NoSuchMethodException ex) {
 367             return null;
 368         }
 369     }
 370 
 371     public final Constructor<?> newConstructorForSerialization(Class<?> cl,


< prev index next >