Package com.sun.codemodel
Class JTypeVar
- java.lang.Object
-
- com.sun.codemodel.JType
-
- com.sun.codemodel.JClass
-
- com.sun.codemodel.JTypeVar
-
- All Implemented Interfaces:
JDeclaration
,JGenerable
,java.lang.Comparable<JType>
public final class JTypeVar extends JClass implements JDeclaration
Type variable used to declare generics.- See Also:
JGenerifiable
-
-
Field Summary
Fields Modifier and Type Field Description private JClass
bound
private java.lang.String
name
-
Fields inherited from class com.sun.codemodel.JClass
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description JTypeVar(JCodeModel owner, java.lang.String _name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JClass
_extends()
Returns the class bound of this variable.java.util.Iterator<JClass>
_implements()
Returns the interface bounds of this variable.JPackage
_package()
Gets the package to which this class belongs.JTypeVar
bound(JClass c)
Adds a bound to this variable.void
declare(JFormatter f)
Prints out the declaration of the variable.java.lang.String
fullName()
Gets the full name of the type.void
generate(JFormatter f)
boolean
isAbstract()
Checks if this class is an abstract class.boolean
isInterface()
Checks if this object represents an interface.java.lang.String
name()
Gets the name of this class.protected JClass
substituteParams(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, erasure, getBaseClass, getBaseClass, getPrimitiveType, getTypeParameters, isAssignableFrom, isParameterized, narrow, narrow, narrow, narrow, narrow, narrow, outer, owner, printLink, staticInvoke, staticInvoke, staticRef, staticRef, toString, typeParams, unboxify, wildcard
-
Methods inherited from class com.sun.codemodel.JType
binaryName, compareTo, elementType, isArray, isPrimitive, isReference, parse
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
bound
private JClass bound
-
-
Constructor Detail
-
JTypeVar
JTypeVar(JCodeModel owner, java.lang.String _name)
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from class:JClass
Gets the name of this class.
-
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.
-
_package
public JPackage _package()
Description copied from class:JClass
Gets the package to which this class belongs. TODO: shall we move move this down?
-
_extends
public JClass _extends()
Returns the class bound of this variable.If no bound is given, this method returns
Object
.- Specified by:
_extends
in 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 thisJClass
is not a class, this method still returnsJClass
forObject
. If this JClass representsObject
, return null.
-
_implements
public java.util.Iterator<JClass> _implements()
Returns the interface bounds of this variable.- Specified by:
_implements
in classJClass
- 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 classJClass
-
isAbstract
public boolean isAbstract()
Description copied from class:JClass
Checks if this class is an abstract class.- Specified by:
isAbstract
in classJClass
-
declare
public void declare(JFormatter f)
Prints out the declaration of the variable.- Specified by:
declare
in interfaceJDeclaration
-
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
forMap<String,Map<Integer>>
.This method needs to work recursively.
- Specified by:
substituteParams
in classJClass
-
generate
public void generate(JFormatter f)
- Specified by:
generate
in interfaceJGenerable
- Overrides:
generate
in classJClass
-
-