public class BeforeAfterStrategy extends ASNodeHandler
BeforeAfterStrategy
implements a before and after IASNode
handler.
When handle(IASNode)
is called on an instance of this class, the
default handle(IASNode)
method will first call the
getBefore()
handle() method , the will call the supers handle()
implementation which is to call the ASNodeHandler.getHandler()
handle() method.
Finally, the getAfter()
handler's handle() method will be called.
Currently, this strategy is used for indenting and IBlockNode
pre and
post symbol management.
Constructor and Description |
---|
BeforeAfterStrategy(IASNodeStrategy handler,
IASNodeStrategy before,
IASNodeStrategy after)
Constructor, creates a strategy that implements a before and after
IASNodeStrategy . |
Modifier and Type | Method and Description |
---|---|
protected void |
after(IASNode node)
Called before the
handle(IASNode) method. |
protected void |
before(IASNode node)
Called after the
handle(IASNode) method. |
IASNodeStrategy |
getAfter()
Returns the
IASNodeStrategy called after the
ASNodeHandler.getHandler() 's handle() method. |
IASNodeStrategy |
getBefore()
Returns the
IASNodeStrategy called before the
ASNodeHandler.getHandler() 's handle() method. |
void |
handle(IASNode node)
The strategy will handle the specific
IASNode . |
void |
setAfter(IASNodeStrategy value)
Sets the after handler.
|
void |
setBefore(IASNodeStrategy value)
Sets the before handler.
|
getHandler, setHandler
public BeforeAfterStrategy(IASNodeStrategy handler, IASNodeStrategy before, IASNodeStrategy after)
IASNodeStrategy
.handler
- The handler that will be called between the before and
after handle(IASNode)
method.before
- The before handler.after
- The after handler.public IASNodeStrategy getBefore()
IASNodeStrategy
called before the
ASNodeHandler.getHandler()
's handle() method.public void setBefore(IASNodeStrategy value)
before
- The before handler.public IASNodeStrategy getAfter()
IASNodeStrategy
called after the
ASNodeHandler.getHandler()
's handle() method.public void setAfter(IASNodeStrategy value)
after
- The after handler.public void handle(IASNode node)
IASNodeStrategy
IASNode
.handle
in interface IASNodeStrategy
handle
in class ASNodeHandler
node
- The IASNode
to handle.protected void after(IASNode node)
handle(IASNode)
method.
If the getAfter()
strategy is null
, this method
does nothing.
node
- The current IASNode
being handled by the strategy.protected void before(IASNode node)
handle(IASNode)
method.
If the getBefore()
strategy is null
, this method
does nothing.
node
- The current IASNode
being handled by the strategy.Copyright © 2016 The Apache Software Foundation. All rights reserved.