|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.validation.DefaultValidationMetadataProvider
public class DefaultValidationMetadataProvider
An implementation of 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 Summary | |
---|---|
DefaultValidationMetadataProvider()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultValidationMetadataProvider()
Method Detail |
---|
public void init(Configuration configuration) throws Exception
configuration
.
init
in interface ConfigurableComponent
configuration
- the Configuration object being used by Stripes
Exception
- 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)
ValidationMetadataProvider
ValidationMetadata
for the given ActionBean
class.
getValidationMetadata
in interface ValidationMetadataProvider
beanType
- any class
ValidationMetadata
. If no validation information
is present for the given class, then an empty map will be returned.public ValidationMetadata getValidationMetadata(Class<?> beanType, ParameterName field)
ValidationMetadataProvider
property
of the given
ActionBean
class.
getValidationMetadata
in interface ValidationMetadataProvider
beanType
- any classfield
- a (possibly nested) property of beanType
ValidationMetadata
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 class
ValidationMetadata
for the
property.
StripesRuntimeException
- if conflicts are found in the validation annotations
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |