org.javalid.annotations.helper
Annotation Type BeanLookup


@Target(value={})
@Retention(value=RUNTIME)
@Documented
public @interface BeanLookup

This annotation should be used inside a @Lookup annotation to specify you wish to use a javabean to perform validation. This one must then specify the bean to use for validation (it must have a no-arg constructor), plus the method to call. Whatever the method and its parameters, it *must* return a List<ValidationMessage> containing validation errors.

Note: It is NOT a lookup as the name might suggest, its simply a java class bean instantiated for validation.

IMPORTANT: By default bean instances are cached (using their beanClass full name) and thus instantiated only once, and the next time the same beanClass is encountered the cached one is used instead. If however, this is not the desired behavior for certain classes set the property cacheBean to false.

Since:
1.0
Version:
1.0
Author:
M.Reuvers
See Also:
Lookup

Required Element Summary
 java.lang.Class beanClass
          The class to use for validation, must be a class which can be instantiated through a no-arg constructor.
 
Optional Element Summary
 boolean cacheBean
          Defaults to true, each bean encountered is cached.
 JvMethod method
          The method to call on the bean class, must return List<ValidationMessage> (empty list if no errors found).
 

Element Detail

beanClass

public abstract java.lang.Class beanClass
The class to use for validation, must be a class which can be instantiated through a no-arg constructor.

Defaults to nothing.

method

public abstract JvMethod method
The method to call on the bean class, must return List<ValidationMessage> (empty list if no errors found). To pass the current object that requires the validation, you can specify a JvParam with valueRetrievalMode=JvParam.MODE_CURRENT_OBJECT.

Defaults to empty method.

Default:
@org.javalid.annotations.core.JvMethod(name="")

cacheBean

public abstract boolean cacheBean
Defaults to true, each bean encountered is cached. Set to false if the bean must be instantiated each time it is encountered.

Default:
true