net.sf.oval.configuration.xml
Class XMLConfigurer
java.lang.Object
net.sf.oval.configuration.xml.XMLConfigurer
- All Implemented Interfaces:
- Configurer
public class XMLConfigurer
- extends Object
- implements Configurer
XStream (http://xstream.codehaus.org/) based XML configuration class.
- Author:
- Sebastian Thomschke
Nested Class Summary |
protected class |
XMLConfigurer.AssertCheckConverter
The converter is needed to allow the rendering of Assert's expr attribute value as an XML node value and not an XML attribute
<assert><expr>... |
protected static class |
XMLConfigurer.XStreamReflectionProvider
This reflection provider applies default values declared on constraint annotations to the corresponding check class |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
listeners
protected final Set<CheckInitializationListener> listeners
XMLConfigurer
public XMLConfigurer()
- creates an XMLConfigurer instance backed by a new XStream instance
using the com.thoughtworks.xstream.io.xml.StaxDriver for XML parsing
if the StAX API is available
- See Also:
StaxDriver
XMLConfigurer
public XMLConfigurer(File xmlConfigFile)
throws IOException
- Throws:
IOException
XMLConfigurer
public XMLConfigurer(InputStream xmlConfigStream)
XMLConfigurer
public XMLConfigurer(Reader xmlConfigReader)
XMLConfigurer
public XMLConfigurer(String xmlConfigAsString)
addCheckInitializationListener
public boolean addCheckInitializationListener(CheckInitializationListener listener)
fromXML
public void fromXML(File input)
throws IOException
- Throws:
IOException
fromXML
public void fromXML(InputStream input)
fromXML
public void fromXML(Reader input)
fromXML
public void fromXML(String input)
getClassConfiguration
public ClassConfiguration getClassConfiguration(Class<?> clazz)
throws InvalidConfigurationException
- Returns the constraint configurations for the given class. This method
is invoked only once by the Validator, the very first time an object
of the given class needs to be validated. The constraint configuration
is then translated into an Validator internal format and cached.
- Specified by:
getClassConfiguration
in interface Configurer
- Parameters:
clazz
- the class to get the configuration for
- Returns:
- The constraint configurations for the given class.
- Throws:
InvalidConfigurationException
- in case of illegal configuration settings
getConstraintSetConfiguration
public ConstraintSetConfiguration getConstraintSetConfiguration(String constraintSetId)
throws InvalidConfigurationException
- Returns the constraint configuration for the constraint set with the
given Id.
- Specified by:
getConstraintSetConfiguration
in interface Configurer
- Parameters:
constraintSetId
- the ID of the constraint set
- Returns:
- The constraint configuration for the constraint set with the given Id.
- Throws:
InvalidConfigurationException
- in case of illegal configuration settings
getPojoConfigurer
public POJOConfigurer getPojoConfigurer()
- Returns:
- the pojoConfigurer
getXStream
public com.thoughtworks.xstream.XStream getXStream()
- Returns:
- the xStream
removeCheckInitializationListener
public boolean removeCheckInitializationListener(CheckInitializationListener listener)
setPojoConfigurer
public void setPojoConfigurer(POJOConfigurer pojoConfigurer)
- Parameters:
pojoConfigurer
- the pojoConfigurer to set
toXML
public String toXML()
toXML
public void toXML(OutputStream out)
toXML
public void toXML(Writer out)
Copyright © 2005-2013 The OVal Development Team. All Rights Reserved.