Class JVar
java.lang.Object
com.sun.codemodel.JExpressionImpl
com.sun.codemodel.JVar
- All Implemented Interfaces:
JAnnotatable, JAssignmentTarget, JDeclaration, JExpression, JGenerable
- Direct Known Subclasses:
JFieldVar
Variables and fields.
-
Method Summary
Modifier and TypeMethodDescriptionAdds an annotation to this variable.annotate(Class<? extends Annotation> clazz) Adds an annotation to this variable.<W extends JAnnotationWriter>
WAdds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.Read-only live view of all annotations on thisJAnnotatableassign(JExpression rhs) assignPlus(JExpression rhs) voidbind(JFormatter f) voidvoidinit(JExpression init) Initialize this variableprotected booleanmods()name()Get the name of this variablevoidChanges the name of this variable.type()Return the type of this variable.Sets the type of this variable.Methods inherited from class JExpressionImpl
_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
-
Method Details
-
init
Initialize this variable- Parameters:
init- JExpression to be used to initialize this field
-
name
-
name
Changes the name of this variable. -
type
-
mods
- Returns:
- the current modifiers of this method. Always return non-null valid object.
-
type
-
annotate
Adds an annotation to this variable.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the field with
-
annotate
Adds an annotation to this variable.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the field with
-
annotate2
Description copied from interface:JAnnotatableAdds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.- Specified by:
annotate2in interfaceJAnnotatable
-
annotations
Description copied from interface:JAnnotatableRead-only live view of all annotations on thisJAnnotatable- Specified by:
annotationsin interfaceJAnnotatable- Returns:
- Can be empty but never null.
-
isAnnotated
protected boolean isAnnotated() -
bind
-
declare
- Specified by:
declarein interfaceJDeclaration
-
generate
- Specified by:
generatein interfaceJGenerable
-
assign
- Specified by:
assignin interfaceJAssignmentTarget
-
assignPlus
- Specified by:
assignPlusin interfaceJAssignmentTarget
-