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 alsoJTypes
.
-
-
Field Summary
Fields Modifier and Type Field Description static JType
BOOLEAN
Theboolean
primitive type.static JType
BYTE
Thebyte
primitive type.static JType
CHAR
Thechar
primitive type.static JType
DOUBLE
Thedouble
primitive type.static JType
FLOAT
Thefloat
primitive type.static JType
INT
Theint
primitive type.static JType
LONG
Thelong
primitive type.static JType[]
NONE
An empty array of types.static JType
OBJECT
The type ofjava.lang.Object
.static JType
SHORT
Theshort
primitive type.static JType
THIS
A special type that always renders to the type of the class it is encountered in.static JType
VOID
Thevoid
type.static JType
WILDCARD
The 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.JType
array()
An array of this type.JType
box()
The primitive-boxed version of this type.JCall
call(java.lang.String name)
Call a static method on this type.JCall
call(javax.lang.model.element.ExecutableElement method)
Call a static method on this type.JType
elementType()
The element type, if this an array (otherwisenull
).JType
erasure()
The erasure of this type.JAssignableExpr
field(java.lang.String name)
Look up a static field on this type.JExpr
methodRef(java.lang.String name)
Get a method reference of this type.JExpr
methodRef(javax.lang.model.element.ExecutableElement method)
Get a method reference of this type.JType
nestedType(java.lang.String name)
Get a nested type within this reference type.java.lang.String
simpleName()
Get the simple name of this type.JType
typeArg(java.lang.Class<?>... args)
This type, with the given generic type arguments.JType
typeArg(java.lang.String... args)
This type, with the given generic type arguments.JType
typeArg(JType... args)
This type, with the given generic type arguments.JType[]
typeArgs()
Get the type arguments of this type.JType
unbox()
The primitive-unboxed version of this type.JType
wildcardExtends()
Get a wildcard that extends this type.JType
wildcardSuper()
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
Thevoid
type.
-
BOOLEAN
static final JType BOOLEAN
Theboolean
primitive type.
-
FLOAT
static final JType FLOAT
Thefloat
primitive type.
-
DOUBLE
static final JType DOUBLE
Thedouble
primitive type.
-
CHAR
static final JType CHAR
Thechar
primitive type.
-
BYTE
static final JType BYTE
Thebyte
primitive type.
-
SHORT
static final JType SHORT
Theshort
primitive type.
-
INT
static final JType INT
Theint
primitive type.
-
LONG
static final JType LONG
Thelong
primitive 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
null
if 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
-
-