net.sf.oval.configuration.xml
Class XMLConfigurer

java.lang.Object
  extended by 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
 
Field Summary
protected  Set<CheckInitializationListener> listeners
           
 
Constructor Summary
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
XMLConfigurer(File xmlConfigFile)
           
XMLConfigurer(InputStream xmlConfigStream)
           
XMLConfigurer(Reader xmlConfigReader)
           
XMLConfigurer(String xmlConfigAsString)
           
 
Method Summary
 boolean addCheckInitializationListener(CheckInitializationListener listener)
           
 void fromXML(File input)
           
 void fromXML(InputStream input)
           
 void fromXML(Reader input)
           
 void fromXML(String input)
           
 ClassConfiguration getClassConfiguration(Class<?> clazz)
          Returns the constraint configurations for the given class.
 ConstraintSetConfiguration getConstraintSetConfiguration(String constraintSetId)
          Returns the constraint configuration for the constraint set with the given Id.
 POJOConfigurer getPojoConfigurer()
           
 com.thoughtworks.xstream.XStream getXStream()
           
 boolean removeCheckInitializationListener(CheckInitializationListener listener)
           
 void setPojoConfigurer(POJOConfigurer pojoConfigurer)
           
 String toXML()
           
 void toXML(OutputStream out)
           
 void toXML(Writer out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected final Set<CheckInitializationListener> listeners
Constructor Detail

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)
Method Detail

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.