public class MacroBlock extends MacroFunctor
MacroBlock allows for aggregation of other IFunctor
instances to a new compound implementation.
Each IFunctor expression is called in the order of definition. The
result of the MacroBlock is the result of the last expression. The
result is undefined when an error was thrown and not handled.
If an error occurs, normal execution is terminated and all error expressions
are executed if available. The error execution may handle the error or
rethrow another. If an error occurs while executing the error expressions,
the execution is terminated and the error is thrown. If no error expressions
are defined, the error is thrown.
After normal execution or error execution is finished, all finally
expressions are performed. If an error occurs while executing the finally
expressions, the finally execution is terminated and the error is thrown. To
ensure that all finally blocks are properly executed, each block
implementation should take care of defensive exception handling.ATTR_DESCRIPTION, ATTR_ICON, ATTR_LABEL, ATTR_TIP| Constructor and Description |
|---|
MacroBlock() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBlockExpression(IFunctor step) |
void |
addBlockExpression(int index,
IFunctor step) |
void |
addErrorExpression(IFunctor step) |
void |
addErrorExpression(int index,
IFunctor step) |
void |
addFinallyExpression(IFunctor step) |
void |
addFinallyExpression(int index,
IFunctor step) |
void |
configure(IElement element) |
List<IFunctor> |
getBlockExpressions() |
List<IFunctor> |
getErrorExpressions() |
List<IFunctor> |
getFinallyExpressions() |
String |
getLabel()
A short string representation (suitable for example for use with an icon
or menu item).
|
Object |
perform(IFunctorCall call)
Perform the encapsulated business logic in the context defined in "call".
|
void |
removeBlockExpression(IFunctor step) |
void |
removeErrorExpression(IFunctor step) |
void |
removeFinallyExpression(IFunctor step) |
void |
serialize(IElement element)
Serialize the state in
element. |
void |
setContext(Object context) |
getClassLoader, getContainer, getContext, getDescription, getIconName, getTip, setContainerpublic void addBlockExpression(IFunctor step)
public void addBlockExpression(int index,
IFunctor step)
public void addErrorExpression(IFunctor step)
public void addErrorExpression(int index,
IFunctor step)
public void addFinallyExpression(IFunctor step)
public void addFinallyExpression(int index,
IFunctor step)
public void configure(IElement element) throws ConfigurationException
configure in interface IElementConfigurableconfigure in class MacroFunctorConfigurationExceptionpublic String getLabel()
IPresentationSupportgetLabel in interface IPresentationSupportgetLabel in class MacroFunctorpublic Object perform(IFunctorCall call) throws FunctorInvocationException
IFunctorcall - The call contextFunctorInvocationException - An exception that raised while executing the business logic
will be wrapped in a FunctorInvocationException.public void removeBlockExpression(IFunctor step)
public void removeErrorExpression(IFunctor step)
public void removeFinallyExpression(IFunctor step)
public void serialize(IElement element) throws ElementSerializationException
IElementSerializableelement. element
represents the receiver immediately, it contains the state information
directly, not as a child element. This means most of the time you have to
change the element name itself and add child elements.serialize in interface IElementSerializableserialize in class MacroFunctorElementSerializationExceptionpublic void setContext(Object context) throws ConfigurationException
setContext in interface IContextSupportsetContext in class MacroFunctorConfigurationExceptionCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.