Package com.sun.codemodel
Class JCodeModel.JReferencedClass
- java.lang.Object
-
- com.sun.codemodel.JType
-
- com.sun.codemodel.JClass
-
- com.sun.codemodel.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 Summary
Fields Modifier and Type Field Description private java.lang.Class<?>_class-
Fields inherited from class com.sun.codemodel.JClass
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description JReferencedClass(java.lang.Class<?> _clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JClass_extends()Gets the super class of this class.java.util.Iterator<JClass>_implements()Iterates all super interfaces directly implemented by this class/interface.JPackage_package()Gets the package to which this class belongs.java.lang.StringbinaryName()Gets the binary name of the type.voiddeclare(JFormatter f)java.lang.StringfullName()Gets the full name of the type.JPrimitiveTypegetPrimitiveType()If this class represents one of the wrapper classes defined in the java.lang package, return the corresponding primitive type.booleanisAbstract()Checks if this class is an abstract class.booleanisArray()Tell whether or not this is an array type.booleanisInterface()Checks if this object represents an interface.java.lang.Stringname()Gets the name of this class.JClassouter()Returns the class in which this class is nested, or null if this is a top-level class.protected JClasssubstituteParams(JTypeVar[] variables, java.util.List<JClass> bindings)Substitutes the type variables with their actual arguments.JTypeVar[]typeParams()Iterates all the type parameters of this class/interface.-
Methods inherited from class com.sun.codemodel.JClass
array, boxify, dotclass, erasure, generate, getBaseClass, getBaseClass, getTypeParameters, isAssignableFrom, isParameterized, narrow, narrow, narrow, narrow, narrow, narrow, owner, printLink, staticInvoke, staticInvoke, staticRef, staticRef, toString, unboxify, wildcard
-
Methods inherited from class com.sun.codemodel.JType
compareTo, elementType, isPrimitive, isReference, parse
-
-
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from class:JClassGets the name of this class.
-
fullName
public java.lang.String fullName()
Description copied from class:JTypeGets the full name of the type. See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.
-
binaryName
public java.lang.String binaryName()
Description copied from class:JTypeGets the binary name of the type. See http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#44909- Overrides:
binaryNamein classJType- Returns:
- Name like "Foo$Bar", "int", "java.lang.String", "java.io.File[]". Never null.
-
outer
public JClass outer()
Description copied from class:JClassReturns the class in which this class is nested, or null if this is a top-level class.
-
_package
public JPackage _package()
Description copied from class:JClassGets the package to which this class belongs. TODO: shall we move move this down?
-
_extends
public JClass _extends()
Description copied from class:JClassGets the super class of this class.- Specified by:
_extendsin classJClass- 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 thisJClassis not a class, this method still returnsJClassforObject. If this JClass representsObject, return null.
-
_implements
public java.util.Iterator<JClass> _implements()
Description copied from class:JClassIterates all super interfaces directly implemented by this class/interface.- Specified by:
_implementsin classJClass- Returns:
- A non-null valid iterator that iterates all
JClassobjects that represents those interfaces implemented by this object.
-
isInterface
public boolean isInterface()
Description copied from class:JClassChecks if this object represents an interface.- Specified by:
isInterfacein classJClass
-
isAbstract
public boolean isAbstract()
Description copied from class:JClassChecks if this class is an abstract class.- Specified by:
isAbstractin classJClass
-
getPrimitiveType
public JPrimitiveType getPrimitiveType()
Description copied from class:JClassIf this class represents one of the wrapper classes defined in the java.lang package, return the corresponding primitive type. Otherwise null.- Overrides:
getPrimitiveTypein classJClass
-
isArray
public boolean isArray()
Description copied from class:JTypeTell whether or not this is an array type.
-
declare
public void declare(JFormatter f)
- Specified by:
declarein interfaceJDeclaration
-
typeParams
public JTypeVar[] typeParams()
Description copied from class:JClassIterates all the type parameters of this class/interface.For example, if this
JClassrepresentsSet<T>, this method returns an array that contains singleJTypeVarfor 'T'.- Overrides:
typeParamsin classJClass
-
substituteParams
protected JClass substituteParams(JTypeVar[] variables, java.util.List<JClass> bindings)
Description copied from class:JClassSubstitutes 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
JClassforMap<String,Map<Integer>>.This method needs to work recursively.
- Specified by:
substituteParamsin classJClass
-
-