Class Reflection


  • @Beta
    public final class Reflection
    extends 
    Static utilities relating to Java reflection.
    Since:
    12.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <?> clazz)
      Returns the package name of clazz according to the Java Language Specification (section 6.7).
      static  classFullName)
      Returns the package name of classFullName according to the Java Language Specification (section 6.7).
      static void <?>... classes)
      Ensures that the given classes are initialized, as described in .
      static <T> T <T> interfaceType,  handler)
      Returns a proxy instance that implements interfaceType by dispatching method invocations to handler.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • getPackageName

        public static  <?> clazz)
        Returns the package name of clazz according to the Java Language Specification (section 6.7). Unlike , this method only parses the class name, without attempting to define the and hence load files.
      • getPackageName

        public static   classFullName)
        Returns the package name of classFullName according to the Java Language Specification (section 6.7). Unlike , this method only parses the class name, without attempting to define the and hence load files.
      • initialize

        public static void <?>... classes)
        Ensures that the given classes are initialized, as described in .

        WARNING: Normally it's a smell if a class needs to be explicitly initialized, because static state hurts system maintainability and testability. In cases when you have no choice while inter-operating with a legacy framework, this method helps to keep the code less ugly.

        Throws:
        - if an exception is thrown during initialization of a class
      • newProxy

        public static <T> T <T> interfaceType,
                                      handler)
        Returns a proxy instance that implements interfaceType by dispatching method invocations to handler. The class loader of interfaceType will be used to define the proxy class. To implement multiple interfaces or specify a class loader, use .
        Throws:
        - if interfaceType does not specify the type of a Java interface