|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.overview.validator.BasicItemNodeValidatorFactory
public class BasicItemNodeValidatorFactory
Node validator factory implementation for BasicItem
node validators.
The key used in createNodeValidator(Object)
should normally be
an Item
object.
Field Summary | |
---|---|
private boolean |
disabled
|
private boolean |
useNullValidator
|
private Map<Object,Class<? extends NodeValidator<? extends BasicItem>>> |
validators
|
Constructor Summary | |
---|---|
BasicItemNodeValidatorFactory()
Creates a new factory. |
Method Summary | |
---|---|
NodeValidator<? extends BasicItem> |
createNodeValidator(Object key)
Create a new node validator that can validate nodes with items of the specified item type. |
boolean |
isDisabled()
Check if node validation has been disabled. |
protected void |
registerCheckedNodeValidator(Object key,
Class<? extends NodeValidator<? extends BasicItem>> validatorClass)
Register a node loader implementation that you are sure fulfills the requirements. |
protected void |
registerDefaultNodeValidators()
Registers default item node validators from BioSource
to Experiment , etc. |
void |
registerNodeValidator(Item key,
Class<? extends NodeValidator<? extends BasicItem>> validatorClass)
Register a node validator implementation. |
void |
setDisabled(boolean disabled)
Disable/enabled node validation programmatically. |
void |
setUsNullValidatorIfNotFound(boolean useNullValidator)
Set a flag that determines if a NullNodeValidator should be used
or if an ItemNotFoundException should be thrown
if no registered node validator is found for a specific key. |
boolean |
useNullValidatorIfNotFound()
Get the null validator setting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Map<Object,Class<? extends NodeValidator<? extends BasicItem>>> validators
private boolean useNullValidator
private boolean disabled
Constructor Detail |
---|
public BasicItemNodeValidatorFactory()
Method Detail |
---|
public boolean isDisabled()
NodeValidatorFactory
isDisabled
in interface NodeValidatorFactory<BasicItem,Object>
public void setDisabled(boolean disabled)
NodeValidatorFactory
NodeValidatorFactory.createNodeValidator(Object)
should return null or a NullNodeValidator
for all
requests.
setDisabled
in interface NodeValidatorFactory<BasicItem,Object>
disabled
- TRUE to disable node validationpublic NodeValidator<? extends BasicItem> createNodeValidator(Object key)
NullNodeValidator
is returned or an exception
is thrown depending on the useNullValidatorIfNotFound()
option.
createNodeValidator
in interface NodeValidatorFactory<BasicItem,Object>
key
- An Item
object
ItemNotFoundException
- If no node loader is found and the
useNullValidatorIfNotFound()
setting is falsepublic boolean useNullValidatorIfNotFound()
setUsNullValidatorIfNotFound(boolean)
public void setUsNullValidatorIfNotFound(boolean useNullValidator)
NullNodeValidator
should be used
or if an ItemNotFoundException
should be thrown
if no registered node validator is found for a specific key.
useNullValidator
- TRUE to use an NullNodeValidator
, FALSE to throw
an exceptionpublic void registerNodeValidator(Item key, Class<? extends NodeValidator<? extends BasicItem>> validatorClass) throws NoSuchMethodException, ClassCastException
ClassUtil.checkAndLoadClass(ClassLoader, String, boolean, Class...)
key
- The item type the node validator handlesvalidatorClass
- The class name of a class that implements NodeValidator
,
or null to unregister an existig validator
NoSuchMethodException
- If the given class has no public no-argument
constructor
ClassCastException
- If the given class doesn't implement the
NodeValidator
interfaceprotected void registerCheckedNodeValidator(Object key, Class<? extends NodeValidator<? extends BasicItem>> validatorClass)
NodeValidator
interface.
registerNodeValidator(Item, Class)
protected void registerDefaultNodeValidators()
BioSource
to Experiment
, etc.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |