|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.iscreen.impl.BaseConfiguredValidator
public abstract class BaseConfiguredValidator
This base class represents a wrapper around a validator that handles the actual call to the validator. This class is subclassed by OGNL or MVEL to handle the actual interpretation of how to handle mappings, etc.
Field Summary | |
---|---|
protected ValidationService |
containingService
|
protected boolean |
declared
|
protected java.lang.String |
doc
|
protected boolean |
failFastFlag
|
protected java.lang.String |
id
|
protected java.lang.String |
ifExp
|
protected ResourceValue |
label
|
protected java.util.Set |
mappings
|
protected java.lang.String |
name
|
protected java.lang.String |
parsedDoc
|
protected BaseConfiguredValidator |
ref
|
protected java.util.Set |
staticProperties
|
protected Validator |
validator
|
protected java.lang.Class |
validatorClass
|
Constructor Summary | |
---|---|
BaseConfiguredValidator()
Default constructor. |
Method Summary | |
---|---|
abstract void |
addMapping(java.lang.String from,
java.lang.String to)
Adds a mapping for mapping the object being validated to the beanToValidate object (that the Validator created). |
abstract void |
addStaticProperty(java.lang.String property,
java.lang.Object obj)
Adds a "static" property to set on the underlying Validator. |
protected abstract java.lang.String |
convertDoc(java.lang.Object contextBean,
java.lang.String unconvertedDoc)
Convert the documentation text using the embedded markers. |
protected abstract void |
executeMappings(java.lang.Object from,
java.lang.Object to)
Maps the appropriate properties from one object to another. |
abstract Validator |
getConfiguredValidator()
Creates the Validator and configures it. |
DocumentationIterator |
getDoc()
Retrieves the documentation (parsed and updated) for this validator. |
protected abstract java.util.Collection |
getFields()
Retrieves the Collection of fields (the 'getter' OGNL expressions) that are used in mapping properties from the JavaBean/Object being validated to the validation bean. |
java.lang.String |
getFieldsTrace()
|
java.lang.String |
getId()
Gets the id of this wrapper. |
java.lang.String |
getIfExpression()
Retrieves the 'if' expression, which is used to determine whether this validator will be executed during validation. |
java.lang.String |
getLabel(java.util.Locale locale)
Gets the value of the label for this Validator wrapper. |
java.util.Set |
getMappings()
Gets the Set of mappings for this Validator and any Validator this Validator references. |
java.lang.String |
getName()
Called to retrieve the "name" of the validator. |
protected java.lang.String |
getRawDoc()
Retrieves the raw documentation for this. |
protected java.lang.String |
getServiceId()
|
java.util.Set |
getStaticProperties()
Retrieves the Set of static properties (which are OgnlPropertyMapping objects). |
java.lang.Class |
getValidatorClass()
Returns the Class of the Validator this class is wrapping (this may retrieve the Class from another wrapper this wrapper references). |
boolean |
isDeclared()
Flag to determine if the validator has been declared or merely referenced |
boolean |
isFailFast()
Whether this wrapper should report to the validation service not to continue validating if this wrapper finds a failure. |
void |
setClassName(java.lang.String className)
Sets the class name of the Validator this class is wrapping. |
void |
setDoc(java.lang.String documentation)
Sets the documentation for this configured validator. |
void |
setFailFast(boolean flag)
Sets whether this wrapper should report to the validation service not to continue validating if this wrapper finds a failure. |
void |
setId(java.lang.String theId)
Sets the id of this wrapper. |
void |
setIfExpression(java.lang.String theExp)
Sets the 'if' expression that will determine whether this validator will be executed during validation. |
void |
setLabel(Resource resource,
java.lang.String key)
Sets the Label for this Validator wrapper. |
void |
setLabel(java.lang.String labelValue)
Sets the label for this Validator wrapper. |
void |
setName(java.lang.String theName)
Sets the name of the validator. |
void |
setRef(BaseConfiguredValidator configuredValidatorRef)
Sets a wrapper this wrapper may reference. |
void |
setValidationService(ValidationService service)
Sets the ValidationService (ValidationSet) that contains this Validator wrapper. |
protected abstract boolean |
shouldExecute(java.lang.Object obj)
Determines whether this validator should be executed or not. |
void |
signalDeclared()
Sets the flag to signal that the validator has been declared, rather than merely referenced |
boolean |
validate(InternalValidatorContext context,
ContextBean contextBean,
ValidationTrace trace,
java.lang.Object obj)
Called to have the wrapper validate the passed object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ValidationService containingService
protected boolean failFastFlag
protected java.lang.String ifExp
protected java.lang.String id
protected ResourceValue label
protected java.lang.String doc
protected java.lang.String parsedDoc
protected java.util.Set mappings
protected java.lang.String name
protected BaseConfiguredValidator ref
protected java.util.Set staticProperties
protected Validator validator
protected java.lang.Class validatorClass
protected boolean declared
Constructor Detail |
---|
public BaseConfiguredValidator()
Method Detail |
---|
public abstract void addMapping(java.lang.String from, java.lang.String to)
from
- The OGNL from expression (getter)to
- The OGNL to expression (setter)public abstract void addStaticProperty(java.lang.String property, java.lang.Object obj)
property
- The OGNL expression to set a valueobj
- The value to set, once, on the Validator to configure it.protected abstract void executeMappings(java.lang.Object from, java.lang.Object to)
from
- The object to map from.to
- The object to map to.public abstract Validator getConfiguredValidator()
protected abstract java.util.Collection getFields()
public java.lang.String getId()
public java.lang.String getLabel(java.util.Locale locale)
public java.util.Set getMappings()
public java.lang.String getFieldsTrace()
public java.lang.String getName()
ValidatorWrapper
getName
in interface ValidatorWrapper
public java.lang.String getIfExpression()
public java.util.Set getStaticProperties()
public java.lang.Class getValidatorClass()
public boolean isFailFast()
public void setClassName(java.lang.String className)
className
- The class name of the Validatorpublic void setFailFast(boolean flag)
flag
- If true, a failure will result in no further validations.public void setId(java.lang.String theId)
theId
- The id of this wrapper.public void setLabel(Resource resource, java.lang.String key)
resource
- The Resource the label's value is inkey
- The key to the label's valuepublic void setLabel(java.lang.String labelValue)
labelValue
- The value of the label.public void setName(java.lang.String theName)
theName
- The name of the validator.public void setIfExpression(java.lang.String theExp)
theExp
- The 'if' expression.public void setDoc(java.lang.String documentation)
documentation
- The documentation for this validator.public DocumentationIterator getDoc()
getDoc
in interface ValidatorWrapper
public void setRef(BaseConfiguredValidator configuredValidatorRef)
configuredValidatorRef
- The delegated parent of this wrapper.public void setValidationService(ValidationService service)
service
- The ValidationService that contains this wrapper.public boolean isDeclared()
public void signalDeclared()
ConfigurationException
- If a re-declaration occurs.public boolean validate(InternalValidatorContext context, ContextBean contextBean, ValidationTrace trace, java.lang.Object obj)
ValidatorWrapper
validate
in interface ValidatorWrapper
context
- The validation context to pass on to the contained
validator.contextBean
- The OGNL root, to be updated as appropriate.trace
- The validation trace to track what calls what.obj
- The object to be validated.
protected java.lang.String getServiceId()
protected abstract java.lang.String convertDoc(java.lang.Object contextBean, java.lang.String unconvertedDoc)
contextBean
- The context bean (root) for converting the doc.unconvertedDoc
- The raw documentation text.
protected java.lang.String getRawDoc()
protected abstract boolean shouldExecute(java.lang.Object obj)
bean
- The object (the one being validated) to use to check the 'if' expression.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |