public abstract class AbstractNestedStructureHouseKeeper extends Object implements NestedStructureHouseKeeper
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractNestedStructureHouseKeeper.Structure |
Constructor and Description |
---|
AbstractNestedStructureHouseKeeper() |
Modifier and Type | Method and Description |
---|---|
Factory |
getFactory() |
protected boolean |
isStackIsHealthy() |
<T extends NestedStructure> |
pop(Class<T> expectedClass)
Pops one element from the stack.
|
void |
push(Class<?> klass,
NestedStructure element)
Push a nested structure object on the housekeeping stack.
|
void |
push(NestedStructure element)
Push a nested structure object on the housekeeping stack.
|
void |
setFactory(Factory factory)
When a factory creates an instance of a class implementing this interface
this method is called to register the factory that created the instance.
|
public Factory getFactory()
public void setFactory(Factory factory)
FactoryManaged
setFactory
in interface FactoryManaged
factory
- the factory that manages the instance.public void push(NestedStructure element)
NestedStructureHouseKeeper
push
in interface NestedStructureHouseKeeper
element
- to push on the stack.protected boolean isStackIsHealthy()
public void push(Class<?> klass, NestedStructure element)
NestedStructureHouseKeeper
push
in interface NestedStructureHouseKeeper
klass
- is the class that we will expect when we pop this element offelement
- the element to be stored on the stack.public <T extends NestedStructure> T pop(Class<T> expectedClass) throws AnalysisException
NestedStructureHouseKeeper
Note that nested element have to be pushed on the stack nested. If we get an element off the stack that was not expected it means syntax error and therefore in this case exception is thrown.
When exception was thrown the functioning of the object is not defined by this interface. Some implementation may seek the appropriate element in the stack and throw off all top element until a proper type of element is found assuming that the user forgot to close some internal programming structured in the scripted language. Other implementations may follow more complex strategy to recover from such an error. In either case the sole reason of further syntax analysis is to discover as many syntax error as possible following the first one.
pop
in interface NestedStructureHouseKeeper
T
- expected type of the elementAnalysisException
- when the top element of the stack is not the type that we
expectCopyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.