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, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittrySetCamelContextgetStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingisSuspended, resume, suspendshutdownpublic 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()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setCamelContext(CamelContext context)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecontext - the Camel contextprotected void doStart()
throws Exception
BaseServiceBaseService.doStop() for more details.doStart in class BaseServiceExceptionBaseService.doStop()protected void doStop()
throws Exception
BaseServiceBaseService.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 BaseServiceExceptionBaseService.doStart()Apache Camel