public class DefaultValidationMetadataProvider extends Object implements ValidationMetadataProvider
ValidationMetadataProvider that scans classes and their superclasses
for properties annotated with Validate and/or ValidateNestedProperties and
exposes the validation metadata specified by those annotations. When searching for annotations,
this implementation looks first at the property's read method (getter), then its write method
(setter), and finally at the field itself.| Constructor and Description |
|---|
DefaultValidationMetadataProvider() |
| Modifier and Type | Method and Description |
|---|---|
Configuration |
getConfiguration()
Get the
Configuration object that was passed into init(Configuration). |
Map<String,ValidationMetadata> |
getValidationMetadata(Class<?> beanType)
Get a map of property names to
ValidationMetadata for the given ActionBean
class. |
ValidationMetadata |
getValidationMetadata(Class<?> beanType,
ParameterName field)
Get the validation metadata associated with the named
property of the given
ActionBean class. |
void |
init(Configuration configuration)
Currently does nothing except store a reference to
configuration. |
protected Map<String,ValidationMetadata> |
loadForClass(Class<?> beanType)
Get validation information for all the properties and nested properties of the given class.
|
public void init(Configuration configuration) throws Exception
configuration.init in interface ConfigurableComponentconfiguration - the Configuration object being used by StripesException - should be thrown if the component cannot be configured well enough to use.public Configuration getConfiguration()
Configuration object that was passed into init(Configuration).public Map<String,ValidationMetadata> getValidationMetadata(Class<?> beanType)
ValidationMetadataProviderValidationMetadata for the given ActionBean
class.getValidationMetadata in interface ValidationMetadataProviderbeanType - any classValidationMetadata. If no validation information
is present for the given class, then an empty map will be returned.public ValidationMetadata getValidationMetadata(Class<?> beanType, ParameterName field)
ValidationMetadataProviderproperty of the given
ActionBean class.getValidationMetadata in interface ValidationMetadataProviderbeanType - any classfield - a (possibly nested) property of beanTypeValidationMetadata object, if there is one associated with the property. If
the property is not to be validated, then null.protected Map<String,ValidationMetadata> loadForClass(Class<?> beanType)
Validate and/or ValidateNestedProperties annotations may be applied to
the property's read method, write method, or field declaration. If a property has a
ValidateNestedProperties annotation, then the nested properties named in its
Validate annotations will be included as well.beanType - a classValidationMetadata for the
property.StripesRuntimeException - if conflicts are found in the validation annotations© Copyright 2005-2006, Stripes Development Team.