| java.lang.Object net.percederberg.grammatica.code.CodeElement net.percederberg.grammatica.code.java.JavaVariable
JavaVariable | public class JavaVariable extends CodeElement (Code) | | A class generating a Java variable declaration. The variable
declaration should be placed as a member in a class.
author: Per Cederberg, version: 1.0 |
Field Summary | |
final public static int | FINAL The final modifier constant. | final public static int | PACKAGE_LOCAL The package local access modifier constant (i.e. | final public static int | PRIVATE The private access modifier constant. | final public static int | PROTECTED The protected access modifier constant. | final public static int | PUBLIC The public access modifier constant. | final public static int | STATIC The static modifier constant. | final public static int | TRANSIENT The transient modifier constant. | final public static int | VOLATILE The volatile modifier constant. |
Constructor Summary | |
public | JavaVariable(String type, String name) Creates a new variable with the specified type and name. | public | JavaVariable(int modifiers, String type, String name) Creates a new variable with the specified modifiers, type and
name. | public | JavaVariable(String type, String name, String initValue) Creates a new variable with the specified type, name and
initializer. | public | JavaVariable(int modifiers, String type, String name, String initValue) Creates a new variable with the specified modifiers, type, name
and initializer. |
Method Summary | |
public void | addComment(JavaComment comment) Adds a comment to this variable. | public void | addVectorInit(String elementValue) Adds initialization code for a vector element value. | public int | category() Returns a numeric category number for the code element. | public void | print(PrintWriter out, CodeStyle style, int indent) Prints the code element to the specified output stream. |
FINAL | final public static int FINAL(Code) | | The final modifier constant.
|
PACKAGE_LOCAL | final public static int PACKAGE_LOCAL(Code) | | The package local access modifier constant (i.e. no modifier).
|
PRIVATE | final public static int PRIVATE(Code) | | The private access modifier constant.
|
PROTECTED | final public static int PROTECTED(Code) | | The protected access modifier constant.
|
PUBLIC | final public static int PUBLIC(Code) | | The public access modifier constant.
|
STATIC | final public static int STATIC(Code) | | The static modifier constant.
|
TRANSIENT | final public static int TRANSIENT(Code) | | The transient modifier constant.
|
VOLATILE | final public static int VOLATILE(Code) | | The volatile modifier constant.
|
JavaVariable | public JavaVariable(String type, String name)(Code) | | Creates a new variable with the specified type and name.
Parameters: type - the variable type Parameters: name - the variable name |
JavaVariable | public JavaVariable(int modifiers, String type, String name)(Code) | | Creates a new variable with the specified modifiers, type and
name.
Parameters: modifiers - the modifier flags to use Parameters: type - the variable type Parameters: name - the variable name |
JavaVariable | public JavaVariable(String type, String name, String initValue)(Code) | | Creates a new variable with the specified type, name and
initializer.
Parameters: type - the variable type Parameters: name - the variable name Parameters: initValue - the initialize value |
JavaVariable | public JavaVariable(int modifiers, String type, String name, String initValue)(Code) | | Creates a new variable with the specified modifiers, type, name
and initializer.
Parameters: modifiers - the modifier flags to use Parameters: type - the variable type Parameters: name - the variable name Parameters: initValue - the initialize value |
addComment | public void addComment(JavaComment comment)(Code) | | Adds a comment to this variable.
Parameters: comment - the comment to add |
addVectorInit | public void addVectorInit(String elementValue)(Code) | | Adds initialization code for a vector element value. Each
vector element value added will be added last in the list of
initialization values. If an init value has been specified with
the constructor, it will be added first in the vector.
Parameters: elementValue - the vector element value |
category | public int category()(Code) | | Returns a numeric category number for the code element. A lower
category number implies that the code element should be placed
before code elements with a higher category number within a
declaration.
the category number |
print | public void print(PrintWriter out, CodeStyle style, int indent)(Code) | | Prints the code element to the specified output stream.
Parameters: out - the output stream Parameters: style - the code style to use Parameters: indent - the indentation level |
|
|