|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<State> output.java.State
public enum State
The state of a CodeBuilder
object. What state the builder is in
constrains the scopes that can be begun; for instance, a method cannot be
defined immediately within another.
The valid state transitions can be summarized thus:
Also, any state can transition toCOMMENT
, but COMMENT
cannot transition to any other state. (This reflects the fact that a comment
can appear anywhere but cannot contain anything but plain text.)
When a scope is closed using a method such as
CodeBuilder.finishClass()
, the builder reverts to its previous
state, following one of the above transitions in reverse.
Enum Constant Summary | |
---|---|
BLOCK
Anything within curly braces in the body of a method. |
|
CLASS
Any class declaration (top-level, inner, local, etc.). |
|
COMMENT
Text within a multiline comment (either JavaDoc or plain). |
|
METHOD
The body of a method. |
|
TOPLEVEL
The top level of the file, containing the package statement, import statements, and classes. |
Method Summary | |
---|---|
static State |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static State[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final State TOPLEVEL
Cannot be contained; can contain only CLASS
and
COMMENT
scopes.
public static final State CLASS
Can be contained by any scope; can contain CLASS
,
METHOD
, and COMMENT
scopes.
public static final State METHOD
Can be contained only by a CLASS
scope; can contain
CLASS
, BLOCK
, and COMMENT
scopes.
public static final State BLOCK
Can be contained either by a METHOD
scope or by another
BLOCK
scope. Can contain CLASS
, BLOCK
,
and COMMENT
scopes.
public static final State COMMENT
Cannot contain other scopes.
Method Detail |
---|
public static final State[] values()
for(State c : State.values()) System.out.println(c);
public static State valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |