Package org.jboss.jdeparser
Interface JType
- All Known Implementing Classes:
AbstractJType,ArrayJType,NarrowedJType,NestedJType,PrimitiveJType,ReferenceJType,ThisJType,WildcardJType
public interface JType
A type specification. See also
JTypes.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JTypeThebooleanprimitive type.static final JTypeThebyteprimitive type.static final JTypeThecharprimitive type.static final JTypeThedoubleprimitive type.static final JTypeThefloatprimitive type.static final JTypeTheintprimitive type.static final JTypeThelongprimitive type.static final JType[]An empty array of types.static final JTypeThe type ofjava.lang.Object.static final JTypeTheshortprimitive type.static final JTypeA special type that always renders to the type of the class it is encountered in.static final JTypeThevoidtype.static final JTypeThe wildcard type of<? extends Object>, also known as<?>. -
Method Summary
Modifier and TypeMethodDescription_class()An expression of the formThisType.class._new()Construct a new instance of this non-array type._new(int dim) Construct a new instance of this array type.Construct a new instance of this array type._newAnon()Construct a new anonymous subclass of this type.Create a new array of this type which is inline-initialized._super()An expression of the formThisType.super._this()An expression of the formThisType.this.Get a nested type within this reference type.Look up a static field on this type.array()An array of this type.box()The primitive-boxed version of this type.Call a static method on this type.call(ExecutableElement method) Call a static method on this type.The element type, if this an array (otherwisenull).erasure()The erasure of this type.Look up a static field on this type.Get a method reference of this type.methodRef(ExecutableElement method) Get a method reference of this type.nestedType(String name) Get a nested type within this reference type.Get the simple name of this type.This type, with the given generic type arguments.This type, with the given generic type arguments.This type, with the given generic type arguments.JType[]typeArgs()Get the type arguments of this type.unbox()The primitive-unboxed version of this type.Get a wildcard that extends this type.Get a wildcard that this type extends.
-
Field Details
-
NONE
An empty array of types. -
THIS
A special type that always renders to the type of the class it is encountered in. -
VOID
Thevoidtype. -
BOOLEAN
Thebooleanprimitive type. -
FLOAT
Thefloatprimitive type. -
DOUBLE
Thedoubleprimitive type. -
CHAR
Thecharprimitive type. -
BYTE
Thebyteprimitive type. -
SHORT
Theshortprimitive type. -
INT
Theintprimitive type. -
LONG
Thelongprimitive type. -
OBJECT
The type ofjava.lang.Object. -
WILDCARD
The wildcard type of<? extends Object>, also known as<?>.
-
-
Method Details
-
simpleName
String simpleName()Get the simple name of this type.- Returns:
- the type's simple name
-
_class
JExpr _class()An expression of the formThisType.class.- Returns:
- the expression
-
_this
JExpr _this()An expression of the formThisType.this. If the type is an array type, an exception is thrown.- Returns:
- the expression
-
_super
JExpr _super()An expression of the formThisType.super. If the type is an array type, an exception is thrown.- Returns:
- the expression
-
array
JType array()An array of this type.- Returns:
- the array type
-
_new
JCall _new()Construct a new instance of this non-array type. If the type is an array type, an exception is thrown.- Returns:
- the construction call
-
_new
Construct a new instance of this array type. If the type is not an array type, an exception is thrown.- Parameters:
dim- the array size- Returns:
- the construction call
-
_new
Construct a new instance of this array type. If the type is not an array type, an exception is thrown.- Parameters:
dim- the array size- Returns:
- the construction call
-
_newArray
JArrayExpr _newArray()Create a new array of this type which is inline-initialized.- Returns:
- the array, initially with zero elements
-
_newAnon
JAnonymousClassDef _newAnon()Construct a new anonymous subclass of this type.- Returns:
- the anonymous subclass definition
-
typeArg
This type, with the given generic type arguments.- Parameters:
args- the type arguments- Returns:
- the generic type
-
typeArg
This type, with the given generic type arguments.- Parameters:
args- the type arguments- Returns:
- the generic type
-
typeArg
This type, with the given generic type arguments.- Parameters:
args- the type arguments- Returns:
- the generic type
-
typeArgs
JType[] typeArgs()Get the type arguments of this type.- Returns:
- the type arguments of this type
-
box
JType box()The primitive-boxed version of this type.- Returns:
- the boxed version of this type
-
unbox
JType unbox()The primitive-unboxed version of this type.- Returns:
- the unboxed version of this type
-
erasure
JType erasure()The erasure of this type.- Returns:
- the erasure of this type
-
elementType
JType elementType()The element type, if this an array (otherwisenull).- Returns:
- the element type, or
nullif it is not an array
-
wildcardExtends
JType wildcardExtends()Get a wildcard that extends this type.- Returns:
- the wildcard
-
wildcardSuper
JType wildcardSuper()Get a wildcard that this type extends.- Returns:
- the wildcard
-
nestedType
Get a nested type within this reference type.- Parameters:
name- the name of the nested type- Returns:
- the nested type
-
$t
Get a nested type within this reference type.- Parameters:
name- the name of the nested type- Returns:
- the nested type
-
field
Look up a static field on this type.- Parameters:
name- the field name- Returns:
- the field expression
-
$v
Look up a static field on this type.- Parameters:
name- the field name- Returns:
- the field expression
-
call
Call a static method on this type.- Parameters:
name- the method to call- Returns:
- the method call
-
call
Call a static method on this type.- Parameters:
method- the method to call- Returns:
- the method call
-
methodRef
Get a method reference of this type.- Parameters:
name- the method name- Returns:
- the method reference expression
-
methodRef
Get a method reference of this type.- Parameters:
method- the method element- Returns:
- the method reference expression
-