Package org.jboss.jdeparser
Class FirstJVarDeclaration
- java.lang.Object
-
- org.jboss.jdeparser.BasicJCommentable
-
- org.jboss.jdeparser.AbstractJDocCommentable
-
- org.jboss.jdeparser.BasicJAnnotatable
-
- org.jboss.jdeparser.FirstJVarDeclaration
-
- All Implemented Interfaces:
BlockContent
,ClassContent
,JAnnotatable
,JClassItem
,JCommentable
,JDocCommentable
,JVarDeclaration
,Writable
- Direct Known Subclasses:
TryJVarDeclaration
class FirstJVarDeclaration extends BasicJAnnotatable implements JVarDeclaration, BlockContent, ClassContent, JClassItem
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.jdeparser.JClassItem
JClassItem.Kind
-
-
Field Summary
Fields Modifier and Type Field Description private int
mods
private java.lang.String
name
private java.util.ArrayList<SuccessorJVarDeclaration>
successors
private JType
type
private JExpr
value
-
Fields inherited from interface org.jboss.jdeparser.JClassItem
SMART_NAME_SORT
-
-
Constructor Summary
Constructors Constructor Description FirstJVarDeclaration(int mods, JType type, java.lang.String name, JExpr value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Methods inherited from class org.jboss.jdeparser.BasicJAnnotatable
annotate, annotate, annotate, writeAnnotations
-
Methods inherited from class org.jboss.jdeparser.AbstractJDocCommentable
deprecated, docComment, writeDocComments
-
Methods inherited from class org.jboss.jdeparser.BasicJCommentable
blockComment, lineComment, writeComments
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.jdeparser.JAnnotatable
annotate, annotate, annotate
-
Methods inherited from interface org.jboss.jdeparser.JCommentable
blockComment, lineComment
-
Methods inherited from interface org.jboss.jdeparser.JDocCommentable
deprecated, docComment
-
-
-
-
Field Detail
-
mods
private final int mods
-
type
private final JType type
-
name
private final java.lang.String name
-
value
private final JExpr value
-
successors
private java.util.ArrayList<SuccessorJVarDeclaration> successors
-
-
Method Detail
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
-
write
void write(SourceFileWriter writer, FormatPreferences.Space beforeSemicolon) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNoSemi
void writeNoSemi(SourceFileWriter writer) throws java.io.IOException
- Throws:
java.io.IOException
-
type
public JType type()
Description copied from interface:JVarDeclaration
Get the variable type.- Specified by:
type
in interfaceJVarDeclaration
- Returns:
- the variable type
-
name
public java.lang.String name()
Description copied from interface:JVarDeclaration
Get the variable name.- Specified by:
name
in interfaceJVarDeclaration
- Returns:
- the variable name
-
mods
int mods()
-
add
public JVarDeclaration add(java.lang.String name, JExpr init)
Description copied from interface:JVarDeclaration
Add another item to this declaration. Subsequent items always have the same type as this item.- Specified by:
add
in interfaceJVarDeclaration
- Parameters:
name
- the variable nameinit
- the variable initializer- Returns:
- the subsequent declaration
-
add
public JVarDeclaration add(java.lang.String name)
Description copied from interface:JVarDeclaration
Add another item to this declaration. Subsequent items always have the same type as this item.- Specified by:
add
in interfaceJVarDeclaration
- Parameters:
name
- the variable name- Returns:
- the subsequent declaration
-
getItemKind
public JClassItem.Kind getItemKind()
Description copied from interface:JClassItem
Get the kind of item.- Specified by:
getItemKind
in interfaceJClassItem
- Returns:
- the item kind
-
getModifiers
public int getModifiers()
Description copied from interface:JClassItem
Get the modifiers of this item.- Specified by:
getModifiers
in interfaceJClassItem
- Returns:
- the modifiers
- See Also:
JMod
-
hasAllModifiers
public boolean hasAllModifiers(int mods)
Description copied from interface:JClassItem
Determine whether this item has all of the modifiers specified by the given bitwise-OR-joined argument.- Specified by:
hasAllModifiers
in interfaceJClassItem
- Parameters:
mods
- the modifier(s)- Returns:
true
if all of the modifiers are present,false
otherwise
-
hasAnyModifier
public boolean hasAnyModifier(int mods)
Description copied from interface:JClassItem
Determine whether this item has any of the modifiers specified by the given bitwise-OR-joined argument.- Specified by:
hasAnyModifier
in interfaceJClassItem
- Parameters:
mods
- the modifier(s)- Returns:
true
if any if the modifiers are present,false
otherwise
-
getName
public java.lang.String getName()
Description copied from interface:JClassItem
Get the name of this element, if there is one.- Specified by:
getName
in interfaceJClassItem
- Returns:
- the name, or
null
if there is none
-
-