Class FindAndReplaceService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.findreplace.FindAndReplaceService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Perform a find and replace on the message", tag="service") public class FindAndReplaceService extends ServiceImp
Implementation ofService
which allows find and replace operations on the message payload.You can specify one or more
FindAndReplaceUnit
's, each of which defines the value to "find" and the value to "replace" with. EachFindAndReplaceUnit
will be applied in order and can be used to replace the first instance or all instances.- See Also:
ConfiguredReplacementSource
,MetadataReplacementSource
In the adapter configuration file this class is aliased as find-and-replace-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 FindAndReplaceService()
Creates a new instance.
-
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<FindAndReplaceUnit>
getFindAndReplaceUnits()
java.lang.Boolean
getReplaceFirstOnly()
Returns replaceFirstOnly.protected void
initService()
void
prepare()
Prepare for initialisation.void
setFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit)
void
setReplaceFirstOnly(java.lang.Boolean b)
Sets replaceFirstOnly.-
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- See Also:
#doService(com.adaptris.core.AdaptrisMessage)
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
getReplaceFirstOnly
public java.lang.Boolean getReplaceFirstOnly()
Returns replaceFirstOnly.
- Returns:
- replaceFirstOnly if true only the first instances of the
String
to replace will be replaced. If false all instances will be replaced.
-
setReplaceFirstOnly
public void setReplaceFirstOnly(java.lang.Boolean b)
Sets replaceFirstOnly.
- Parameters:
b
- if true only the first instances of theString
to replace will be replaced. If false all instances will be replaced; default is null (false)
-
getFindAndReplaceUnits
public java.util.List<FindAndReplaceUnit> getFindAndReplaceUnits()
-
setFindAndReplaceUnits
public void setFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit)
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
-