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}
FAILED, INITIALIZED, lock, log, NEW, SHUTDOWN, SHUTTINGDOWN, 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.
|
doInit, doResume, doShutdown, doSuspend, getStatus, init, 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
public Validator()
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 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
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.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 ServiceSupport
Exception
ServiceSupport.doStart()
Apache Camel