class FirstJVarDeclaration extends BasicJAnnotatable implements JVarDeclaration, BlockContent, ClassContent, JClassItem
JClassItem.Kind
Modifier and Type | Field and Description |
---|---|
private int |
mods |
private java.lang.String |
name |
private java.util.ArrayList<SuccessorJVarDeclaration> |
successors |
private JType |
type |
private JExpr |
value |
SMART_NAME_SORT
Constructor and Description |
---|
FirstJVarDeclaration(int mods,
JType type,
java.lang.String name,
JExpr value) |
Modifier and Type | Method and Description |
---|---|
JVarDeclaration |
add(java.lang.String name)
Add another item to this declaration.
|
JVarDeclaration |
add(java.lang.String name,
JExpr init)
Add another item to this declaration.
|
JClassItem.Kind |
getItemKind()
Get the kind of item.
|
int |
getModifiers()
Get the modifiers of this item.
|
java.lang.String |
getName()
Get the name of this element, if there is one.
|
boolean |
hasAllModifiers(int mods)
Determine whether this item has all of the modifiers specified by the given bitwise-OR-joined argument.
|
boolean |
hasAnyModifier(int mods)
Determine whether this item has any of the modifiers specified by the given bitwise-OR-joined argument.
|
(package private) int |
mods() |
java.lang.String |
name()
Get the variable name.
|
JType |
type()
Get the variable type.
|
void |
write(SourceFileWriter writer) |
(package private) void |
write(SourceFileWriter writer,
FormatPreferences.Space beforeSemicolon) |
(package private) void |
writeNoSemi(SourceFileWriter writer) |
annotate, annotate, annotate, writeAnnotations
deprecated, docComment, writeDocComments
blockComment, lineComment, writeComments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
annotate, annotate, annotate
deprecated, docComment
blockComment, lineComment
private final int mods
private final JType type
private final java.lang.String name
private final JExpr value
private java.util.ArrayList<SuccessorJVarDeclaration> successors
public void write(SourceFileWriter writer) throws java.io.IOException
void write(SourceFileWriter writer, FormatPreferences.Space beforeSemicolon) throws java.io.IOException
java.io.IOException
void writeNoSemi(SourceFileWriter writer) throws java.io.IOException
java.io.IOException
public JType type()
JVarDeclaration
type
in interface JVarDeclaration
public java.lang.String name()
JVarDeclaration
name
in interface JVarDeclaration
int mods()
public JVarDeclaration add(java.lang.String name, JExpr init)
JVarDeclaration
add
in interface JVarDeclaration
name
- the variable nameinit
- the variable initializerpublic JVarDeclaration add(java.lang.String name)
JVarDeclaration
add
in interface JVarDeclaration
name
- the variable namepublic JClassItem.Kind getItemKind()
JClassItem
getItemKind
in interface JClassItem
public int getModifiers()
JClassItem
getModifiers
in interface JClassItem
JMod
public boolean hasAllModifiers(int mods)
JClassItem
hasAllModifiers
in interface JClassItem
mods
- the modifier(s)true
if all of the modifiers are present, false
otherwisepublic boolean hasAnyModifier(int mods)
JClassItem
hasAnyModifier
in interface JClassItem
mods
- the modifier(s)true
if any if the modifiers are present, false
otherwisepublic java.lang.String getName()
JClassItem
getName
in interface JClassItem
null
if there is none