Top Description Fields Constructors Methods
com.sun.codemodel

public Class JVar

extends JExpressionImpl
implements JDeclaration, JAssignmentTarget, JAnnotatable
Class Inheritance
All Implemented Interfaces
com.sun.codemodel.JAnnotatable, com.sun.codemodel.JAssignmentTarget, com.sun.codemodel.JExpression, com.sun.codemodel.JGenerable, com.sun.codemodel.JDeclaration
Known Direct Subclasses
com.sun.codemodel.JFieldVar
Imports
java.lang.annotation.Annotation, java.util.ArrayList, .List, .Collection, .Collections

Variables and fields.

Field Summary

Modifier and TypeField and Description
private List<JAnnotationUse>
annotations

Annotations on this variable.

private JExpression
init

Initialization of the variable in its declaration

private JMods
mods

Modifiers.

private String
name

Name of the variable

private JType
type

JType of the variable

Constructor Summary

AccessConstructor and Description
pack-priv
JVar(JMods mods, JType
Datatype of this variable
type
,
String
Name of this variable
name
,
JExpression
Value to initialize this variable to
init
)

JVar constructor

Method Summary

Modifier and TypeMethod and Description
public JAnnotationUse
annotate(JClass
The annotation class to annotate the field with
clazz
)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

public void
public JAnnotationUse
annotate(Class<? extends Annotation>
The annotation class to annotate the field with
clazz
)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

public <W extends JAnnotationWriter<? extends Annotation>> W
annotate2(Class<W> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate2.

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

public Collection<JAnnotationUse>
annotations()

Implements com.sun.codemodel.JAnnotatable.annotations.

Read-only live view of all annotations on this

public JExpression
public JExpression
public void
public void
public void
public JVar
init(JExpression
JExpression to be used to initialize this field
init
)

Initialize this variable

protected boolean
public JMods
mods()

Returns: the current modifiers of this method.

public String

Returns:

Name of the variable
name
()

Get the name of this variable

public void
name(String name)

Changes the name of this variable.

public boolean
removeAnnotation(JAnnotationUse annotation)

Implements com.sun.codemodel.JAnnotatable.removeAnnotation.

Removes annotation from this program element.

public JType

Returns:

always non-null.
type
()

Return the type of this variable.

public JType

Returns:

the old type value. always non-null.
type
(JType
must not be null.
newType
)

Sets the type of this variable.

Inherited from com.sun.codemodel.JExpressionImpl:
_instanceofbandborcandcomplementcomponentcordecrdiveqgtgteincrinvokeinvokeltlteminusminusmodmulnenotplusrefrefshlshrshrzxor

Field Detail

annotationsback to summary
private List<JAnnotationUse> annotations

Annotations on this variable. Lazily created.

initback to summary
private JExpression init

Initialization of the variable in its declaration

modsback to summary
private JMods mods

Modifiers.

nameback to summary
private String name

Name of the variable

typeback to summary
private JType type

JType of the variable

Constructor Detail

JVarback to summary
pack-priv JVar(JMods mods, JType type, String name, JExpression init)

JVar constructor

Parameters
type:JType

Datatype of this variable

name:String

Name of this variable

init:JExpression

Value to initialize this variable to

Method Detail

annotateback to summary
public JAnnotationUse annotate(JClass clazz)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

Parameters
clazz:JClass

The annotation class to annotate the field with

Annotations
@Override
annotateback to summary
public void annotate(JAnnotationUse annotation)
annotateback to summary
public JAnnotationUse annotate(Class<? extends Annotation> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

Parameters
clazz:Class<? extends Annotation>

The annotation class to annotate the field with

Annotations
@Override
annotate2back to summary
public <W extends JAnnotationWriter<? extends Annotation>> W annotate2(Class<W> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate2.

Doc from com.sun.codemodel.JAnnotatable.annotate2.

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

Annotations
@Override
annotationsback to summary
public Collection<JAnnotationUse> annotations()

Implements com.sun.codemodel.JAnnotatable.annotations.

Doc from com.sun.codemodel.JAnnotatable.annotations.

Read-only live view of all annotations on this

Annotations
@Override
assignback to summary
public JExpression assign(JExpression rhs)

Implements com.sun.codemodel.JAssignmentTarget.assign.

Annotations
@Override
assignPlusback to summary
public JExpression assignPlus(JExpression rhs)

Implements com.sun.codemodel.JAssignmentTarget.assignPlus.

Annotations
@Override
bindback to summary
public void bind(JFormatter f)
declareback to summary
public void declare(JFormatter f)

Implements com.sun.codemodel.JDeclaration.declare.

Annotations
@Override
generateback to summary
public void generate(JFormatter f)

Implements com.sun.codemodel.JGenerable.generate.

Annotations
@Override
initback to summary
public JVar init(JExpression init)

Initialize this variable

Parameters
init:JExpression

JExpression to be used to initialize this field

isAnnotatedback to summary
protected boolean isAnnotated()
modsback to summary
public JMods mods()
Returns:JMods

the current modifiers of this method. Always return non-null valid object.

nameback to summary
public String name()

Get the name of this variable

Returns:String

Name of the variable

nameback to summary
public void name(String name)

Changes the name of this variable.

removeAnnotationback to summary
public boolean removeAnnotation(JAnnotationUse annotation)

Implements com.sun.codemodel.JAnnotatable.removeAnnotation.

Doc from com.sun.codemodel.JAnnotatable.removeAnnotation.

Removes annotation from this program element.

Annotations
@Override
typeback to summary
public JType type()

Return the type of this variable.

Returns:JType

always non-null.

typeback to summary
public JType type(JType newType)

Sets the type of this variable.

Parameters
newType:JType

must not be null.

Returns:JType

the old type value. always non-null.