Package org.jboss.jdeparser
Class AbstractJType
- java.lang.Object
-
- org.jboss.jdeparser.AbstractJType
-
- All Implemented Interfaces:
JType
- Direct Known Subclasses:
ArrayJType
,NarrowedJType
,NestedJType
,PrimitiveJType
,ReferenceJType
,ThisJType
,WildcardJType
abstract class AbstractJType extends java.lang.Object implements JType
-
-
Field Summary
Fields Modifier and Type Field Description private ArrayJType
array
private CachingLinkedHashMap<java.lang.String,JAssignableExpr>
staticRefs
private WildcardJType
wildcardExtends
private WildcardJType
wildcardSuper
-
Constructor Summary
Constructors Constructor Description AbstractJType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete 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
).boolean
equals(java.lang.Object other)
(package private) abstract boolean
equals(AbstractJType other)
JType
erasure()
The erasure of this type.JAssignableExpr
field(java.lang.String name)
Look up a static field on this type.abstract int
hashCode()
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.(package private) static AbstractJType
of(JType type)
(package private) java.lang.String
qualifiedName()
abstract java.lang.String
simpleName()
Get the simple name of this type.abstract java.lang.String
toString()
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.(package private) abstract void
writeDirect(SourceFileWriter sourceFileWriter)
-
-
-
Field Detail
-
array
private ArrayJType array
-
wildcardExtends
private WildcardJType wildcardExtends
-
wildcardSuper
private WildcardJType wildcardSuper
-
staticRefs
private CachingLinkedHashMap<java.lang.String,JAssignableExpr> staticRefs
-
-
Method Detail
-
of
static AbstractJType of(JType type)
-
qualifiedName
java.lang.String qualifiedName()
-
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
equals
abstract boolean equals(AbstractJType other)
-
simpleName
public abstract java.lang.String simpleName()
Description copied from interface:JType
Get the simple name of this type.- Specified by:
simpleName
in interfaceJType
- Returns:
- the type's simple name
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
_class
public JExpr _class()
Description copied from interface:JType
An expression of the formThisType.class
.
-
_this
public JExpr _this()
Description copied from interface:JType
An expression of the formThisType.this
. If the type is an array type, an exception is thrown.
-
_super
public JExpr _super()
Description copied from interface:JType
An expression of the formThisType.super
. If the type is an array type, an exception is thrown.
-
_new
public JCall _new()
Description copied from interface:JType
Construct a new instance of this non-array type. If the type is an array type, an exception is thrown.
-
_new
public JExpr _new(JExpr dim)
Description copied from interface:JType
Construct a new instance of this array type. If the type is not an array type, an exception is thrown.
-
_new
public JExpr _new(int dim)
Description copied from interface:JType
Construct a new instance of this array type. If the type is not an array type, an exception is thrown.
-
_newArray
public JArrayExpr _newArray()
Description copied from interface:JType
Create a new array of this type which is inline-initialized.
-
_newAnon
public JAnonymousClassDef _newAnon()
Description copied from interface:JType
Construct a new anonymous subclass of this type.
-
typeArg
public JType typeArg(java.lang.String... args)
Description copied from interface:JType
This type, with the given generic type arguments.
-
typeArg
public JType typeArg(JType... args)
Description copied from interface:JType
This type, with the given generic type arguments.
-
typeArg
public JType typeArg(java.lang.Class<?>... args)
Description copied from interface:JType
This type, with the given generic type arguments.
-
typeArgs
public JType[] typeArgs()
Description copied from interface:JType
Get the type arguments of this type.
-
elementType
public JType elementType()
Description copied from interface:JType
The element type, if this an array (otherwisenull
).- Specified by:
elementType
in interfaceJType
- Returns:
- the element type, or
null
if it is not an array
-
box
public JType box()
Description copied from interface:JType
The primitive-boxed version of this type.
-
unbox
public JType unbox()
Description copied from interface:JType
The primitive-unboxed version of this type.
-
wildcardExtends
public JType wildcardExtends()
Description copied from interface:JType
Get a wildcard that extends this type.- Specified by:
wildcardExtends
in interfaceJType
- Returns:
- the wildcard
-
wildcardSuper
public JType wildcardSuper()
Description copied from interface:JType
Get a wildcard that this type extends.- Specified by:
wildcardSuper
in interfaceJType
- Returns:
- the wildcard
-
nestedType
public JType nestedType(java.lang.String name)
Description copied from interface:JType
Get a nested type within this reference type.- Specified by:
nestedType
in interfaceJType
- Parameters:
name
- the name of the nested type- Returns:
- the nested type
-
$t
public JType $t(java.lang.String name)
Description copied from interface:JType
Get a nested type within this reference type.
-
field
public JAssignableExpr field(java.lang.String name)
Description copied from interface:JType
Look up a static field on this type.
-
$v
public JAssignableExpr $v(java.lang.String name)
Description copied from interface:JType
Look up a static field on this type.
-
call
public JCall call(java.lang.String name)
Description copied from interface:JType
Call a static method on this type.
-
call
public JCall call(javax.lang.model.element.ExecutableElement method)
Description copied from interface:JType
Call a static method on this type.
-
methodRef
public JExpr methodRef(java.lang.String name)
Description copied from interface:JType
Get a method reference of this type.
-
methodRef
public JExpr methodRef(javax.lang.model.element.ExecutableElement method)
Description copied from interface:JType
Get a method reference of this type.
-
writeDirect
abstract void writeDirect(SourceFileWriter sourceFileWriter) throws java.io.IOException
- Throws:
java.io.IOException
-
-