Class AddFormattedMetadataService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.AddFormattedMetadataService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Add a formatted metadata item to a Message", tag="service,metadata") public class AddFormattedMetadataService extends ServiceImp
Add a formatted metadata item to a Message.Allows you to add a new metadata key using
String.format()
as the syntax.In the adapter configuration file this class is aliased as add-formatted-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description AddFormattedMetadataService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.java.util.List<java.lang.String>
getArgumentMetadataKeys()
ElementFormatter
getElementFormatter()
Get the element formatter.java.lang.String
getFormatString()
java.lang.String
getMetadataKey()
protected void
initService()
void
prepare()
Prepare for initialisation.void
setArgumentMetadataKeys(java.util.List<java.lang.String> l)
void
setElementFormatter(ElementFormatter elementFormatter)
Set the element formatter.void
setFormatString(java.lang.String formatString)
Set the format string that complies withString.format(String, Object...)
.void
setMetadataKey(java.lang.String metadatakey)
AddFormattedMetadataService
withArgumentMetadataKeys(java.lang.String... s)
AddFormattedMetadataService
withArgumentMetadataKeys(java.util.List<java.lang.String> s)
AddFormattedMetadataService
withFormatString(java.lang.String s)
AddFormattedMetadataService
withMetadataKey(java.lang.String s)
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
getFormatString
public java.lang.String getFormatString()
- Returns:
- the formatString
-
setFormatString
public void setFormatString(java.lang.String formatString)
Set the format string that complies withString.format(String, Object...)
.- Parameters:
formatString
- the formatString to set
-
withFormatString
public AddFormattedMetadataService withFormatString(java.lang.String s)
-
getArgumentMetadataKeys
public java.util.List<java.lang.String> getArgumentMetadataKeys()
- Returns:
- the argumentMetadataKeys
-
setArgumentMetadataKeys
public void setArgumentMetadataKeys(java.util.List<java.lang.String> l)
- Parameters:
l
- the argumentMetadataKeys to set
-
withArgumentMetadataKeys
public AddFormattedMetadataService withArgumentMetadataKeys(java.util.List<java.lang.String> s)
-
withArgumentMetadataKeys
public AddFormattedMetadataService withArgumentMetadataKeys(java.lang.String... s)
-
getMetadataKey
public java.lang.String getMetadataKey()
- Returns:
- the metadatakey
-
setMetadataKey
public void setMetadataKey(java.lang.String metadatakey)
- Parameters:
metadatakey
- the metadatakey to set
-
withMetadataKey
public AddFormattedMetadataService withMetadataKey(java.lang.String s)
-
getElementFormatter
public ElementFormatter getElementFormatter()
Get the element formatter.- Returns:
- The element formatter.
-
setElementFormatter
public void setElementFormatter(ElementFormatter elementFormatter)
Set the element formatter.- Parameters:
elementFormatter
- The element formatter.
-
-