Package com.sun.codemodel
Class JNarrowedClass
- java.lang.Object
-
- com.sun.codemodel.JType
-
- com.sun.codemodel.JClass
-
- com.sun.codemodel.JNarrowedClass
-
- All Implemented Interfaces:
JGenerable,java.lang.Comparable<JType>
class JNarrowedClass extends JClass
Represents X<Y>. TODO: consider separating the decl and the use.
-
-
Constructor Summary
Constructors Constructor Description JNarrowedClass(JClass basis, JClass arg)JNarrowedClass(JClass basis, java.util.List<JClass> args)
-
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.booleanequals(java.lang.Object obj)JClasserasure()Returns the erasure of this type.java.lang.StringfullName()Gets the full name of the type.voidgenerate(JFormatter f)java.util.List<JClass>getTypeParameters()If this class is parameterized, return the type parameter of the given index.inthashCode()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.JClassnarrow(JClass clazz)"Narrows" a generic class to a concrete class by specifying a type argument.JClassnarrow(JClass... clazz)(package private) voidprintLink(JFormatter f)Prints the class name in javadoc @link format.protected JClasssubstituteParams(JTypeVar[] variables, java.util.List<JClass> bindings)Substitutes the type variables with their actual arguments.-
Methods inherited from class com.sun.codemodel.JClass
array, boxify, dotclass, getBaseClass, getBaseClass, getPrimitiveType, isAssignableFrom, isParameterized, narrow, narrow, narrow, narrow, outer, owner, staticInvoke, staticInvoke, staticRef, staticRef, toString, typeParams, unboxify, wildcard
-
Methods inherited from class com.sun.codemodel.JType
compareTo, elementType, isPrimitive, isReference, parse
-
-
-
-
Method Detail
-
narrow
public JClass narrow(JClass clazz)
Description copied from class:JClass"Narrows" a generic class to a concrete class by specifying a type argument..narrow(X)buildsSet<X>fromSet.
-
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.
-
generate
public void generate(JFormatter f)
- Specified by:
generatein interfaceJGenerable- Overrides:
generatein classJClass
-
printLink
void printLink(JFormatter f)
Description copied from class:JClassPrints the class name in javadoc @link format.
-
_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.
-
erasure
public JClass erasure()
Description copied from class:JTypeReturns the erasure of this type.
-
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
-
isArray
public boolean isArray()
Description copied from class:JTypeTell whether or not this is an array type.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
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
-
getTypeParameters
public java.util.List<JClass> getTypeParameters()
Description copied from class:JClassIf this class is parameterized, return the type parameter of the given index.- Overrides:
getTypeParametersin classJClass
-
-