public abstract class Validator extends ServiceSupport implements CamelContextAware
org.apache.camel.processor.ContractAdvice
applies Validator if input/output type is
declared on a route with validation enabled.org.apache.camel.processor.ContractAdvice} {@link org.apache.camel.model.InputTypeDefinition}
{@link org.apache.camel.model.OutputTypeDefinition}
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
Constructor and Description |
---|
Validator() |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
DataType |
getType()
Get 'from' data type.
|
void |
setCamelContext(CamelContext context)
Injects the
CamelContext |
Validator |
setType(String type)
Set data type.
|
String |
toString() |
abstract void |
validate(Message message,
DataType type)
Perform data validation with specified type.
|
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
trySetCamelContext
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
isSuspended, resume, suspend
shutdown
public abstract void validate(Message message, DataType type) throws ValidationException
message
- message to apply validationtype
- the data typeValidationException
- thrown if any validation error is detectedpublic DataType getType()
public CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext context)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
context
- the Camel contextprotected void doStart() throws Exception
BaseService
BaseService.doStop()
for more details.doStart
in class BaseService
Exception
BaseService.doStop()
protected void doStop() throws Exception
BaseService
BaseService.doStop()
method when the service is being stopped. This method
will also be invoked if the service is still in uninitialized state (eg has not been started). The
method is always called to allow the service to do custom logic when the service is being stopped, such as
when CamelContext
is shutting down.doStop
in class BaseService
Exception
BaseService.doStart()
Apache Camel