Package org.jboss.jdeparser
Interface JType
-
- All Known Implementing Classes:
AbstractJType,ArrayJType,NarrowedJType,NestedJType,PrimitiveJType,ReferenceJType,ThisJType,WildcardJType
public interface JTypeA type specification. See alsoJTypes.
-
-
Field Summary
Fields Modifier and Type Field Description static JTypeBOOLEANThebooleanprimitive type.static JTypeBYTEThebyteprimitive type.static JTypeCHARThecharprimitive type.static JTypeDOUBLEThedoubleprimitive type.static JTypeFLOATThefloatprimitive type.static JTypeINTTheintprimitive type.static JTypeLONGThelongprimitive type.static JType[]NONEAn empty array of types.static JTypeOBJECTThe type ofjava.lang.Object.static JTypeSHORTTheshortprimitive type.static JTypeTHISA special type that always renders to the type of the class it is encountered in.static JTypeVOIDThevoidtype.static JTypeWILDCARDThe wildcard type of<? extends Object>, also known as<?>.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JExpr_class()An expression of the formThisType.class.JCall_new()Construct a new instance of this non-array type.JExpr_new(int dim)Construct a new instance of this array type.JExpr_new(JExpr dim)Construct a new instance of this array type.JAnonymousClassDef_newAnon()Construct a new anonymous subclass of this type.JArrayExpr_newArray()Create a new array of this type which is inline-initialized.JExpr_super()An expression of the formThisType.super.JExpr_this()An expression of the formThisType.this.JType$t(java.lang.String name)Get a nested type within this reference type.JAssignableExpr$v(java.lang.String name)Look up a static field on this type.JTypearray()An array of this type.JTypebox()The primitive-boxed version of this type.JCallcall(java.lang.String name)Call a static method on this type.JCallcall(javax.lang.model.element.ExecutableElement method)Call a static method on this type.JTypeelementType()The element type, if this an array (otherwisenull).JTypeerasure()The erasure of this type.JAssignableExprfield(java.lang.String name)Look up a static field on this type.JExprmethodRef(java.lang.String name)Get a method reference of this type.JExprmethodRef(javax.lang.model.element.ExecutableElement method)Get a method reference of this type.JTypenestedType(java.lang.String name)Get a nested type within this reference type.java.lang.StringsimpleName()Get the simple name of this type.JTypetypeArg(java.lang.Class<?>... args)This type, with the given generic type arguments.JTypetypeArg(java.lang.String... args)This type, with the given generic type arguments.JTypetypeArg(JType... args)This type, with the given generic type arguments.JType[]typeArgs()Get the type arguments of this type.JTypeunbox()The primitive-unboxed version of this type.JTypewildcardExtends()Get a wildcard that extends this type.JTypewildcardSuper()Get a wildcard that this type extends.
-
-
-
Field Detail
-
NONE
static final JType[] NONE
An empty array of types.
-
THIS
static final JType THIS
A special type that always renders to the type of the class it is encountered in.
-
VOID
static final JType VOID
Thevoidtype.
-
BOOLEAN
static final JType BOOLEAN
Thebooleanprimitive type.
-
FLOAT
static final JType FLOAT
Thefloatprimitive type.
-
DOUBLE
static final JType DOUBLE
Thedoubleprimitive type.
-
CHAR
static final JType CHAR
Thecharprimitive type.
-
BYTE
static final JType BYTE
Thebyteprimitive type.
-
SHORT
static final JType SHORT
Theshortprimitive type.
-
INT
static final JType INT
Theintprimitive type.
-
LONG
static final JType LONG
Thelongprimitive type.
-
OBJECT
static final JType OBJECT
The type ofjava.lang.Object.
-
WILDCARD
static final JType WILDCARD
The wildcard type of<? extends Object>, also known as<?>.
-
-
Method Detail
-
simpleName
java.lang.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
JExpr _new(JExpr dim)
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
JExpr _new(int dim)
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
JType typeArg(java.lang.String... args)
This type, with the given generic type arguments.- Parameters:
args- the type arguments- Returns:
- the generic type
-
typeArg
JType typeArg(JType... args)
This type, with the given generic type arguments.- Parameters:
args- the type arguments- Returns:
- the generic type
-
typeArg
JType typeArg(java.lang.Class<?>... args)
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
JType nestedType(java.lang.String name)
Get a nested type within this reference type.- Parameters:
name- the name of the nested type- Returns:
- the nested type
-
$t
JType $t(java.lang.String name)
Get a nested type within this reference type.- Parameters:
name- the name of the nested type- Returns:
- the nested type
-
field
JAssignableExpr field(java.lang.String name)
Look up a static field on this type.- Parameters:
name- the field name- Returns:
- the field expression
-
$v
JAssignableExpr $v(java.lang.String name)
Look up a static field on this type.- Parameters:
name- the field name- Returns:
- the field expression
-
call
JCall call(java.lang.String name)
Call a static method on this type.- Parameters:
name- the method to call- Returns:
- the method call
-
call
JCall call(javax.lang.model.element.ExecutableElement method)
Call a static method on this type.- Parameters:
method- the method to call- Returns:
- the method call
-
methodRef
JExpr methodRef(java.lang.String name)
Get a method reference of this type.- Parameters:
name- the method name- Returns:
- the method reference expression
-
methodRef
JExpr methodRef(javax.lang.model.element.ExecutableElement method)
Get a method reference of this type.- Parameters:
method- the method element- Returns:
- the method reference expression
-
-