|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.code.CodeElement | +--net.percederberg.grammatica.code.java.JavaVariable
A class generating a Java variable declaration. The variable declaration should be placed as a member in a class.
Field Summary | |
static int |
FINAL
The final modifier constant. |
static int |
PACKAGE_LOCAL
The package local access modifier constant (i.e. no modifier). |
static int |
PRIVATE
The private access modifier constant. |
static int |
PROTECTED
The protected access modifier constant. |
static int |
PUBLIC
The public access modifier constant. |
static int |
STATIC
The static modifier constant. |
static int |
TRANSIENT
The transient modifier constant. |
static int |
VOLATILE
The volatile modifier constant. |
Constructor Summary | |
JavaVariable(int modifiers,
java.lang.String type,
java.lang.String name)
Creates a new variable with the specified modifiers, type and name. |
|
JavaVariable(int modifiers,
java.lang.String type,
java.lang.String name,
java.lang.String initValue)
Creates a new variable with the specified modifiers, type, name and initializer. |
|
JavaVariable(java.lang.String type,
java.lang.String name)
Creates a new variable with the specified type and name. |
|
JavaVariable(java.lang.String type,
java.lang.String name,
java.lang.String initValue)
Creates a new variable with the specified type, name and initializer. |
Method Summary | |
void |
addComment(JavaComment comment)
Adds a comment to this variable. |
void |
addVectorInit(java.lang.String elementValue)
Adds initialization code for a vector element value. |
int |
category()
Returns a numeric category number for the code element. |
void |
print(java.io.PrintWriter out,
CodeStyle style,
int indent)
Prints the code element to the specified output stream. |
Methods inherited from class net.percederberg.grammatica.code.CodeElement |
compareTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PUBLIC
public static final int PROTECTED
public static final int PACKAGE_LOCAL
public static final int PRIVATE
public static final int STATIC
public static final int FINAL
public static final int TRANSIENT
public static final int VOLATILE
Constructor Detail |
public JavaVariable(java.lang.String type, java.lang.String name)
type
- the variable typename
- the variable namepublic JavaVariable(int modifiers, java.lang.String type, java.lang.String name)
modifiers
- the modifier flags to usetype
- the variable typename
- the variable namepublic JavaVariable(java.lang.String type, java.lang.String name, java.lang.String initValue)
type
- the variable typename
- the variable nameinitValue
- the initialize valuepublic JavaVariable(int modifiers, java.lang.String type, java.lang.String name, java.lang.String initValue)
modifiers
- the modifier flags to usetype
- the variable typename
- the variable nameinitValue
- the initialize valueMethod Detail |
public void addComment(JavaComment comment)
comment
- the comment to addpublic void addVectorInit(java.lang.String elementValue)
elementValue
- the vector element valuepublic int category()
category
in class CodeElement
public void print(java.io.PrintWriter out, CodeStyle style, int indent)
print
in class CodeElement
out
- the output streamstyle
- the code style to useindent
- the indentation level
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |