Class JCodeModel.JReferencedClass

  • All Implemented Interfaces:
    JDeclaration, JGenerable, java.lang.Comparable<JType>
    Enclosing class:
    JCodeModel

    private class JCodeModel.JReferencedClass
    extends JClass
    implements JDeclaration
    References to existing classes.

    JReferencedClass is kept in a pool so that they are shared. There is one pool for each JCodeModel object.

    It is impossible to cache JReferencedClass globally only because there is the _package() method, which obtains the owner JPackage object, which is scoped to JCodeModel.

    • Field Detail

      • _class

        private final java.lang.Class<?> _class
    • Constructor Detail

      • JReferencedClass

        JReferencedClass​(java.lang.Class<?> _clazz)
    • Method Detail

      • name

        public java.lang.String name()
        Description copied from class: JClass
        Gets the name of this class.
        Specified by:
        name in class JClass
        Returns:
        name of this class, without any qualification. For example, this method returns "String" for java.lang.String.
      • fullName

        public java.lang.String fullName()
        Description copied from class: JType
        Gets the full name of the type. See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.
        Specified by:
        fullName in class JType
        Returns:
        Strings like "int", "java.lang.String", "java.io.File[]". Never null.
      • binaryName

        public java.lang.String binaryName()
        Description copied from class: JType
        Gets the binary name of the type. See http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#44909
        Overrides:
        binaryName in class JType
        Returns:
        Name like "Foo$Bar", "int", "java.lang.String", "java.io.File[]". Never null.
      • outer

        public JClass outer()
        Description copied from class: JClass
        Returns the class in which this class is nested, or null if this is a top-level class.
        Overrides:
        outer in class JClass
      • _package

        public JPackage _package()
        Description copied from class: JClass
        Gets the package to which this class belongs. TODO: shall we move move this down?
        Specified by:
        _package in class JClass
      • _extends

        public JClass _extends()
        Description copied from class: JClass
        Gets the super class of this class.
        Specified by:
        _extends in class JClass
        Returns:
        Returns the JClass representing the superclass of the entity (class or interface) represented by this JClass. Even if no super class is given explicitly or this JClass is not a class, this method still returns JClass for Object. If this JClass represents Object, return null.
      • _implements

        public java.util.Iterator<JClass> _implements()
        Description copied from class: JClass
        Iterates all super interfaces directly implemented by this class/interface.
        Specified by:
        _implements in class JClass
        Returns:
        A non-null valid iterator that iterates all JClass objects that represents those interfaces implemented by this object.
      • isInterface

        public boolean isInterface()
        Description copied from class: JClass
        Checks if this object represents an interface.
        Specified by:
        isInterface in class JClass
      • isAbstract

        public boolean isAbstract()
        Description copied from class: JClass
        Checks if this class is an abstract class.
        Specified by:
        isAbstract in class JClass
      • getPrimitiveType

        public JPrimitiveType getPrimitiveType()
        Description copied from class: JClass
        If this class represents one of the wrapper classes defined in the java.lang package, return the corresponding primitive type. Otherwise null.
        Overrides:
        getPrimitiveType in class JClass
      • isArray

        public boolean isArray()
        Description copied from class: JType
        Tell whether or not this is an array type.
        Overrides:
        isArray in class JType
      • typeParams

        public JTypeVar[] typeParams()
        Description copied from class: JClass
        Iterates all the type parameters of this class/interface.

        For example, if this JClass represents Set<T>, this method returns an array that contains single JTypeVar for 'T'.

        Overrides:
        typeParams in class JClass
      • substituteParams

        protected JClass substituteParams​(JTypeVar[] variables,
                                          java.util.List<JClass> bindings)
        Description copied from class: JClass
        Substitutes the type variables with their actual arguments.

        For example, when this class is Map<String,Map<V>>, (where V then doing substituteParams( V, Integer ) returns a JClass for Map<String,Map<Integer>>.

        This method needs to work recursively.

        Specified by:
        substituteParams in class JClass