Class ClassFactory

    • Constructor Detail

      • ClassFactory

        public ClassFactory​(Factory factory)
        Creates a class sub-factory.
        Parameters:
        factory - the parent factory
    • Method Detail

      • create

        public <T> CtClass<T> create​(CtClass<?> declaringClass,
                                     java.lang.String simpleName)
        Creates an inner class.
        Parameters:
        declaringClass - declaring class
        simpleName - simple name of inner class (without . or $)
      • create

        public <T> CtClass<T> create​(CtPackage owner,
                                     java.lang.String simpleName)
        Creates a top-level class.
        Parameters:
        owner - the declaring package
        simpleName - the simple name
      • create

        public <T> CtClass<T> create​(java.lang.String qualifiedName)
        Creates a class from its qualified name.
        Type Parameters:
        T - type of created class
        Parameters:
        qualifiedName - full name of class to create. Name can contain $ for inner types
      • get

        public <T> CtClass<T> get​(java.lang.Class<?> cl)
        Gets a class from its runtime Java class.
        Overrides:
        get in class TypeFactory
        Type Parameters:
        T - type of created class
        Parameters:
        cl - the java class: note that this class should be Class<T> but it then poses problem when T is a generic type itself
      • get

        public <T> CtClass<T> get​(java.lang.String qualifiedName)
        Searches for a class from his qualified name.
        Overrides:
        get in class TypeFactory
        Type Parameters:
        T - the type of the class
        Parameters:
        qualifiedName - to search
        Returns:
        found class or null