public class JVar extends JExpressionImpl implements JDeclaration, JAssignmentTarget, JAnnotatable
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<JAnnotationUse> |
annotations
Annotations on this variable.
|
private JExpression |
init
Initialization of the variable in its declaration
|
private JMods |
mods
Modifiers.
|
private java.lang.String |
name
Name of the variable
|
private JType |
type
JType of the variable
|
| Constructor and Description |
|---|
JVar(JMods mods,
JType type,
java.lang.String name,
JExpression init)
JVar constructor
|
| Modifier and Type | Method and Description |
|---|---|
JAnnotationUse |
annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Adds an annotation to this variable.
|
JAnnotationUse |
annotate(JClass clazz)
Adds an annotation to this variable.
|
<W extends JAnnotationWriter> |
annotate2(java.lang.Class<W> clazz)
Adds an annotation to this program element
and returns a type-safe writer to fill in the values of such annotations.
|
java.util.Collection<JAnnotationUse> |
annotations()
Read-only live view of all annotations on this
JAnnotatable |
JExpression |
assign(JExpression rhs) |
JExpression |
assignPlus(JExpression rhs) |
void |
bind(JFormatter f) |
void |
declare(JFormatter f) |
void |
generate(JFormatter f) |
JVar |
init(JExpression init)
Initialize this variable
|
protected boolean |
isAnnotated() |
JMods |
mods() |
java.lang.String |
name()
Get the name of this variable
|
void |
name(java.lang.String name)
Changes the name of this variable.
|
JType |
type()
Return the type of this variable.
|
JType |
type(JType newType)
Sets the type of this variable.
|
_instanceof, band, bor, cand, complement, component, cor, decr, div, eq, gt, gte, incr, invoke, invoke, lt, lte, minus, minus, mod, mul, ne, not, plus, ref, ref, shl, shr, shrz, xorprivate JMods mods
private JType type
private java.lang.String name
private JExpression init
private java.util.List<JAnnotationUse> annotations
JVar(JMods mods, JType type, java.lang.String name, JExpression init)
type - Datatype of this variablename - Name of this variableinit - Value to initialize this variable topublic JVar init(JExpression init)
init - JExpression to be used to initialize this fieldpublic java.lang.String name()
public void name(java.lang.String name)
public JType type()
public JMods mods()
public JType type(JType newType)
newType - must not be null.public JAnnotationUse annotate(JClass clazz)
annotate in interface JAnnotatableclazz - The annotation class to annotate the field withpublic JAnnotationUse annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
annotate in interface JAnnotatableclazz - The annotation class to annotate the field withpublic <W extends JAnnotationWriter> W annotate2(java.lang.Class<W> clazz)
JAnnotatableannotate2 in interface JAnnotatablepublic java.util.Collection<JAnnotationUse> annotations()
JAnnotatableJAnnotatableannotations in interface JAnnotatableprotected boolean isAnnotated()
public void bind(JFormatter f)
public void declare(JFormatter f)
declare in interface JDeclarationpublic void generate(JFormatter f)
generate in interface JGenerablepublic JExpression assign(JExpression rhs)
assign in interface JAssignmentTargetpublic JExpression assignPlus(JExpression rhs)
assignPlus in interface JAssignmentTarget