public class JVar extends JExpressionImpl implements JDeclaration, JAssignmentTarget, JAnnotatable
Modifier and Type | Method and Description |
---|---|
JAnnotationUse |
annotate(Class<? extends Annotation> clazz)
Adds an annotation to this variable.
|
JAnnotationUse |
annotate(JClass clazz)
Adds an annotation to this variable.
|
<W extends JAnnotationWriter> |
annotate2(Class<W> clazz)
Adds an annotation to this program element
and returns a type-safe writer to fill in the values of such annotations.
|
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() |
String |
name()
Get the name of this variable
|
void |
name(String name)
Changes the name of this variable.
|
boolean |
removeAnnotation(JAnnotationUse annotation)
Removes annotation from this program element.
|
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, xor
public JVar init(JExpression init)
init
- JExpression to be used to initialize this fieldpublic String name()
public void name(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 JAnnotatable
clazz
- The annotation class to annotate the field withpublic JAnnotationUse annotate(Class<? extends Annotation> clazz)
annotate
in interface JAnnotatable
clazz
- The annotation class to annotate the field withpublic <W extends JAnnotationWriter> W annotate2(Class<W> clazz)
JAnnotatable
annotate2
in interface JAnnotatable
public boolean removeAnnotation(JAnnotationUse annotation)
JAnnotatable
removeAnnotation
in interface JAnnotatable
annotation
- The annotation to be removed from the program elementpublic Collection<JAnnotationUse> annotations()
JAnnotatable
JAnnotatable
annotations
in interface JAnnotatable
protected boolean isAnnotated()
public void bind(JFormatter f)
public void declare(JFormatter f)
declare
in interface JDeclaration
public void generate(JFormatter f)
generate
in interface JGenerable
public JExpression assign(JExpression rhs)
assign
in interface JAssignmentTarget
public JExpression assignPlus(JExpression rhs)
assignPlus
in interface JAssignmentTarget
Copyright © 2017 JBoss by Red Hat. All rights reserved.