Package com.sun.codemodel
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<? extends Annotation>>
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.booleanremoveAnnotation(JAnnotationUse annotation) Removes annotation from this program element.type()Return the type of this variable.Sets the type of this variable.Methods inherited from class com.sun.codemodel.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
Get the name of this variable- Returns:
- Name of the variable
-
name
Changes the name of this variable. -
type
Return the type of this variable.- Returns:
- always non-null.
-
mods
- Returns:
- the current modifiers of this method. Always return non-null valid object.
-
type
Sets the type of this variable.- Parameters:
newType- must not be null.- Returns:
- the old type value. always non-null.
-
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- Returns:
-
removeAnnotation
Description copied from interface:JAnnotatableRemoves annotation from this program element.- Specified by:
removeAnnotationin interfaceJAnnotatable- Parameters:
annotation- The annotation to be removed from the program element
-
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
-