public class ExceptionFromMetadata extends ExceptionFromMetadataImpl
ExceptionGenerator
implementation that generates the exception from metadata.
Use this class with ThrowExceptionService
to throw an exception as part of a workflow. The exception message (i.e.
Throwable.getMessage()
) is derived from the configured metadata key. If the metadata key does not exist (or returns no
value) then the default exception message is used to generate the exception. Note that this always throws an
exception.
In the adapter configuration file this class is aliased as exception-from-metadata which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
ExceptionFromMetadata() |
ExceptionFromMetadata(java.lang.String defaultMessage) |
ExceptionFromMetadata(java.lang.String defaultMessage,
java.lang.String metadataKey) |
Modifier and Type | Method and Description |
---|---|
ServiceException |
create(AdaptrisMessage msg)
Generate a service exception from the AdaptrisMessage.
|
java.lang.String |
getDefaultExceptionMessage()
Returns the configured exception message to use.
|
void |
setDefaultExceptionMessage(java.lang.String s)
Sets the configured exception message to use.
|
getExceptionMessageMetadataKey, setExceptionMessageMetadataKey
public ExceptionFromMetadata()
public ExceptionFromMetadata(java.lang.String defaultMessage)
public ExceptionFromMetadata(java.lang.String defaultMessage, java.lang.String metadataKey)
public java.lang.String getDefaultExceptionMessage()
public void setDefaultExceptionMessage(java.lang.String s)
s
- the configured exception message to use.public ServiceException create(AdaptrisMessage msg)
ExceptionGenerator
msg
- the message