public class StatefulState extends java.lang.Object implements IState, IStateful
IStateful and IState. You can read individual
values from it and you can pass the entire class to an IWritableState to save all the
values.
Instances of this class should be immutable.
| Modifier and Type | Class and Description |
|---|---|
private static class |
StatefulState.StatefulStateWriter
StatefulState instances should be kept immutable, so the writer must not be exposed.
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.String> |
attributes |
private java.util.List<StatefulState> |
children |
private java.lang.String |
type |
| Modifier | Constructor and Description |
|---|---|
private |
StatefulState(java.lang.String type) |
| Modifier and Type | Method and Description |
|---|---|
static StatefulState |
create(IStateful state)
Create a new instance.
|
java.lang.String |
getAttribute(java.lang.String key)
Gets a named attribute value.
|
java.lang.String[] |
getAttributeKeys()
Return an array with the attribute keys for this state.
|
StatefulState |
getChild(java.lang.String type)
Gets a child of the named type.
|
StatefulState[] |
getChildren()
Gets all child nodes.
|
StatefulState[] |
getChildren(java.lang.String type)
Gets all child nodes of a named type.
|
java.lang.String |
getType()
Get the node type of this state.
|
void |
saveTo(IWritableState state)
Saves the state for this object into a state object.
|
java.lang.String |
toString() |
private final java.lang.String type
private final java.util.Map<java.lang.String,java.lang.String> attributes
private final java.util.List<StatefulState> children
public java.lang.String getType()
IStatepublic StatefulState getChild(java.lang.String type)
IStatepublic java.lang.String[] getAttributeKeys()
IStategetAttributeKeys in interface IStatepublic java.lang.String getAttribute(java.lang.String key)
IStategetAttribute in interface IStatekey - attribute keypublic StatefulState[] getChildren()
IStategetChildren in interface IStatepublic StatefulState[] getChildren(java.lang.String type)
IStategetChildren in interface IStatetype - node typepublic void saveTo(IWritableState state)
IStatefulpublic static StatefulState create(IStateful state)
state - object whose state will be loaded into the new instancepublic java.lang.String toString()
toString in class java.lang.Object