org.springjutsu.validation.executors
Class RuleExecutorContainer

java.lang.Object
  extended by org.springjutsu.validation.executors.RuleExecutorContainer

public class RuleExecutorContainer
extends Object

Stores all discovered named rule executors, and makes them available as validation rule types. Will discover both rule executors which are provided through the customRuleExecutors property, as well as those which are annotated with @ConfiguredRuleExecutor

Author:
Clark Duplichien

Nested Class Summary
static class RuleExecutorContainer.RuleExecutorBeanRegistrant
          Used by @see{ValidationConfigurationParser} to register executors wired in the XML config.
 
Field Summary
protected  boolean addDefaultRuleExecutors
          Can configure this to false if user doesn't want the default executors.
protected  org.springframework.beans.factory.BeanFactory beanFactory
          Use the bean factory to look up annotated rule executors.
protected  List<RuleExecutorContainer.RuleExecutorBeanRegistrant> beanRegistrants
          A list of rule executors registered as beans by @see{}
protected  Map<String,RuleExecutor> ruleExecutors
          A map of rule name to the executor.
 
Constructor Summary
RuleExecutorContainer()
           
 
Method Summary
protected  void addDefaultRuleExecutors()
          Instantiates and adds some basic default rules.
 void discoverAnnotatedRuleExecutors()
          Finds the annotated rule executors by searching the bean factory.
 RuleExecutor getRuleExecutorByName(String executorName)
          Gets a rule executor by rule name.
 void setAddDefaultRuleExecutors(boolean addDefaultRuleExecutors)
          Set to false if user does not want the default rule executors.
 void setCustomRuleExecutor(String executorName, RuleExecutor ruleExecutor)
          Set custom rule executor with a specific name.
 void setCustomRuleExecutors(Map<String,RuleExecutor> customRuleExecutors)
          Set custom rule executors with specific names.
 void setRuleExecutorBeanRegistrants(List<RuleExecutorContainer.RuleExecutorBeanRegistrant> registrants)
          Hook by which @see{ValidationConfigurationParser} registers XML defined rule executors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ruleExecutors

protected Map<String,RuleExecutor> ruleExecutors
A map of rule name to the executor.


beanRegistrants

protected List<RuleExecutorContainer.RuleExecutorBeanRegistrant> beanRegistrants
A list of rule executors registered as beans by @see{}


addDefaultRuleExecutors

protected boolean addDefaultRuleExecutors
Can configure this to false if user doesn't want the default executors.


beanFactory

@Autowired
protected org.springframework.beans.factory.BeanFactory beanFactory
Use the bean factory to look up annotated rule executors.

Constructor Detail

RuleExecutorContainer

public RuleExecutorContainer()
Method Detail

discoverAnnotatedRuleExecutors

@PostConstruct
public void discoverAnnotatedRuleExecutors()
                                    throws org.springframework.beans.BeansException
Finds the annotated rule executors by searching the bean factory.

Throws:
org.springframework.beans.BeansException - on a bad.

setCustomRuleExecutors

public void setCustomRuleExecutors(Map<String,RuleExecutor> customRuleExecutors)
Set custom rule executors with specific names.

Parameters:
customRuleExecutors - the rules to set.

setCustomRuleExecutor

public void setCustomRuleExecutor(String executorName,
                                  RuleExecutor ruleExecutor)
Set custom rule executor with a specific name. Throws IllegalArgumentException if a rule already exists with that name.

Parameters:
executorName - Name of the rule to set
ruleExecutor - The rule executor to set.

getRuleExecutorByName

public RuleExecutor getRuleExecutorByName(String executorName)
Gets a rule executor by rule name.

Parameters:
executorName - Name of the rule executor.
Returns:
RuleExecutor with that name.

addDefaultRuleExecutors

protected void addDefaultRuleExecutors()
Instantiates and adds some basic default rules.


setAddDefaultRuleExecutors

public void setAddDefaultRuleExecutors(boolean addDefaultRuleExecutors)
Set to false if user does not want the default rule executors.

Parameters:
addDefaultRuleExecutors -

setRuleExecutorBeanRegistrants

public void setRuleExecutorBeanRegistrants(List<RuleExecutorContainer.RuleExecutorBeanRegistrant> registrants)
Hook by which @see{ValidationConfigurationParser} registers XML defined rule executors

Parameters:
registrants - @see{ValidationConfigurationParser} RuleExecutorBeanRegistrants to register.


Copyright © 2013 Spring Jutsu. All Rights Reserved.