< 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     /** Gets the shared array of parameter types of an Executable.
 349      */
 350     public Class<?>[] getExecutableSharedParameterTypes(Executable ex) {
 351         return langReflectAccess().getExecutableSharedParameterTypes(ex);
 352     }
 353 
 354     //--------------------------------------------------------------------------
 355     //
 356     // Routines used by serialization
 357     //
 358     //
 359 
 360     public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
 361         if (!Externalizable.class.isAssignableFrom(cl)) {
 362             return null;
 363         }
 364         try {
 365             Constructor<?> cons = cl.getConstructor();
 366             cons.setAccessible(true);
 367             return cons;
 368         } catch (NoSuchMethodException ex) {
 369             return null;
 370         }
 371     }
 372 
 373     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     //--------------------------------------------------------------------------
 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,


< prev index next >