public class CodeExit<T> extends Object implements IFunctor<T>, IClassLoaderAccess, IElementConfigurable, IElementSerializable, IDeclarationSupport, IPresentationSupport
IFunctor implemented in a "foreign" language such as
a scripting language or a proprietary syntax.
This is a flexible and powerful pattern if you need pluggable functors in your application to dynamically add features.
| Modifier and Type | Field and Description |
|---|---|
static String |
EA_NAME |
static String |
EA_SOURCE |
static String |
EA_TYPE |
static String |
EE_ARG |
static String |
EE_DECLARATIONS |
static String |
EE_HANDLER |
ATTR_DESCRIPTION, ATTR_ICON, ATTR_LABEL, ATTR_TIP| Constructor and Description |
|---|
CodeExit()
A no-arg constructor for easy reflective access.
|
CodeExit(Object owner) |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(IElement pElement) |
CodeExit<?> |
copy() |
static CodeExit<?> |
createFromElement(IElement element) |
boolean |
exists() |
ClassLoader |
getClassLoader()
The
ClassLoader to be used when accessing resources. |
ICodeExitHandler |
getCodeExitHandler() |
Object |
getCompiledSource() |
IDeclarationBlock |
getDeclarationBlock()
The block of declarations available so far for this.
|
String |
getDescription()
A long, descriptive string representation.
|
IElement |
getElement()
The
IElement that was used to configure this. |
IElement |
getHandlerElement()
The
IElement that was used configured to be forwarded to a
ICodeExitHandler. |
String |
getIconName()
A name for an icon.
|
String |
getLabel()
A short string representation (suitable for example for use with an icon
or menu item).
|
String |
getName() |
Object |
getOwner()
A generic link to an object that is the "owner" of this.
|
String |
getSource()
The source code.
|
String |
getSourceExpanded(IArgs args) |
String |
getTip()
An "intermediate" length description (suitable for example with a
tooltip).
|
String |
getType()
The type.
|
boolean |
isDefinedSource() |
boolean |
isDefinedType() |
T |
perform(IFunctorCall call)
Perform the encapsulated business logic in the context defined in "call".
|
void |
serialize(IElement element)
Serialize the state in
element. |
void |
setClassLoader(ClassLoader classLoader)
Set the
ClassLoader to be used with this CodeExit. |
void |
setCompiledSource(Object compiledSource) |
void |
setName(String name) |
void |
setOwner(Object owner)
Set an owner for the
CodeExit. |
void |
setSource(String value)
Assign the source.
|
void |
setType(String type)
Assign the type.
|
public static final String EA_NAME
public static final String EE_ARG
public static final String EE_HANDLER
public static final String EE_DECLARATIONS
public static final String EA_SOURCE
public static final String EA_TYPE
public CodeExit()
public CodeExit(Object owner)
public static CodeExit<?> createFromElement(IElement element) throws ObjectCreationException
ObjectCreationExceptionpublic void configure(IElement pElement) throws ConfigurationException
configure in interface IElementConfigurableConfigurationExceptionpublic CodeExit<?> copy()
public boolean exists()
public ClassLoader getClassLoader()
ClassLoader to be used when accessing resources.getClassLoader in interface IClassLoaderSupportClassLoader to be used when accessing resources.public ICodeExitHandler getCodeExitHandler()
public Object getCompiledSource()
public IDeclarationBlock getDeclarationBlock()
IDeclarationSupportgetDeclarationBlock in interface IDeclarationSupportpublic String getDescription()
IPresentationSupportgetDescription in interface IPresentationSupportpublic IElement getElement()
IElement that was used to configure this.public IElement getHandlerElement()
IElement that was used configured to be forwarded to a
ICodeExitHandler.IElement that was used configured to be forwarded to
a handler.public String getIconName()
IPresentationSupportgetIconName in interface IPresentationSupportpublic String getLabel()
IPresentationSupportgetLabel in interface IPresentationSupportpublic String getName()
public Object getOwner()
public String getSource()
public String getTip()
IPresentationSupportgetTip in interface IPresentationSupportpublic String getType()
ICodeExitHandler
instances to support different implementation languages.public boolean isDefinedSource()
public boolean isDefinedType()
public T perform(IFunctorCall call) throws FunctorInvocationException
IFunctorperform in interface IFunctor<T>call - The call contextFunctorInvocationException - An exception that raised while executing the business logic
will be wrapped in a FunctorInvocationException.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 IElementSerializableElementSerializationExceptionpublic void setClassLoader(ClassLoader classLoader)
ClassLoader to be used with this CodeExit. This
should be the ClassLoader instance that would give access to all
resources needed by the CodeExit's business logic implementation.setClassLoader in interface IClassLoaderAccessclassLoader - The ClassLoader to be used to access the resources
needed by the CodeExit's business logic
implementation.public void setCompiledSource(Object compiledSource)
public void setName(String name)
public void setOwner(Object owner)
CodeExit.
This should be used in conjunction with the no-arg constructor in reflective programming only.
owner - public void setSource(String value)
value - The source string.public void setType(String type)
type - The type string.Copyright © 2013 intarsys consulting GmbH. All Rights Reserved.