it.avutils.jmapper.xml
Class XmlHandler

java.lang.Object
  extended by it.avutils.jmapper.xml.XmlHandler

public class XmlHandler
extends Object

XmlHandler handles the XML File Configuration.

Author:
Alessandro Vurro

Constructor Summary
XmlHandler()
          The empty constructor defines a new xml configuration file positioned at the application root.
XmlHandler(String xmlPath)
          Xml File is handled at development time from xmlPath.
 
Method Summary
 XmlHandler addAnnotatedClass()
          Add all Annotated classes to Xml Configuration.
 XmlHandler addAnnotatedClass(Class<?>... classes)
          Add the annotated classes given as input to Xml Configuration.
 XmlHandler addAnnotatedClassAll(Class<?>... classes)
          Add the annotated classes given as input to Xml Configuration.
 XmlHandler addAttributes(Class<?> aClass, Attribute... attributes)
          Adds attributes to the existent Class in the Xml configuration.
 XmlHandler addClass(Class<?> clazz, Attribute... attributes)
          This method adds a specific Class to Xml Configuration File.
 XmlHandler addClass(Class<?> clazz, String... attributes)
          This method adds a specific Class to Xml Configuration File.
 XmlHandler cleanAnnotatedClass()
          Cleans up all annotated classes from the configuration
 XmlHandler cleanAnnotatedClass(Class<?>... classes)
          Cleans up the annotated classes, given as input, from the configuration.
 XmlHandler cleanAnnotatedClassAll(Class<?>... classes)
          Cleans up the annotated classes, given as input, from the configuration.
 XmlHandler deleteAnnotatedClasses()
          Eliminates all classes annotated, from Xml configuration.
 XmlHandler deleteAttributes(Class<?> aClass, String... attributes)
          Deletes attributes to the existent Class in the Xml configuration.
 XmlHandler deleteClass(Class<?>... classes)
          This method remove the classes given as input, from xml mapping File.
 XmlHandler fromXmlToAnnotation()
          Adds annotations to all classes presents in the Xml configuration.
 XmlHandler fromXmlToAnnotation(Class<?>... classes)
          Adds annotations to classes given as input starting from Xml configuration.
 XmlHandler fromXmlToAnnotationAll(Class<?>... classes)
          Adds annotations to classes given as input starting from Xml configuration.
 XML getXML()
          For debug porpouse
 XmlHandler overrideAnnotatedClass()
          This method rewrites the xml configuration of only those classes configured in annotation and xml.
 XmlHandler overrideAnnotatedClass(Class<?>... classes)
          This method rewrites the xml configuration only if the classes, geiven as input, are configured in annotation and xml..
 XmlHandler overrideAnnotatedClassAll(Class<?>... classes)
          This method rewrite a Xml Configuration of the Annotated Class given as input.
 XmlHandler overrideClass(Class<?> aClass, Attribute... attributes)
          This method rewrite a configuration of the Class given as input, with this attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlHandler

public XmlHandler()
The empty constructor defines a new xml configuration file positioned at the application root.


XmlHandler

public XmlHandler(String xmlPath)
Xml File is handled at development time from xmlPath. You must define only the file name, JMapper finds it recursively. For example: if you have a file situated in the xml folder ("xml/mapper.xml") you must instantiate XmlHandler as follows: new XmlHandler("mapper.xml");

Parameters:
xmlPath - xml path
Method Detail

cleanAnnotatedClassAll

public XmlHandler cleanAnnotatedClassAll(Class<?>... classes)
Cleans up the annotated classes, given as input, from the configuration.
If the class has inner classes and they are mapped, their configuration will be removed.

Parameters:
classes -
Returns:
this instance of XmlHandler

cleanAnnotatedClass

public XmlHandler cleanAnnotatedClass(Class<?>... classes)
Cleans up the annotated classes, given as input, from the configuration.
If the class has inner classes and they are mapped, their configuration will be not removed.

Parameters:
classes -
Returns:
this instance of XmlHandler

cleanAnnotatedClass

public XmlHandler cleanAnnotatedClass()
Cleans up all annotated classes from the configuration

Returns:
this instance of XmlHandler

addAnnotatedClassAll

public XmlHandler addAnnotatedClassAll(Class<?>... classes)
Add the annotated classes given as input to Xml Configuration.
If the class has inner classes and they are mapped, their configuration will be added too.

Parameters:
classes - annotated classes to add to Xml Configuration
Returns:
this instance of XmlHandler

addAnnotatedClass

public XmlHandler addAnnotatedClass(Class<?>... classes)
Add the annotated classes given as input to Xml Configuration.
If the class has inner classes and they are mapped, their configuration will be not added too.

Parameters:
classes - annotated classes to add to Xml Configuration
Returns:
this instance of XmlHandler

addAnnotatedClass

public XmlHandler addAnnotatedClass()
Add all Annotated classes to Xml Configuration.

Returns:
this instance of XmlHandler

overrideAnnotatedClassAll

public XmlHandler overrideAnnotatedClassAll(Class<?>... classes)
This method rewrite a Xml Configuration of the Annotated Class given as input.
If the class has inner classes and they are mapped, their configuration will be rewritten.

Parameters:
classes - Classes to rewrite
Returns:
this instance of XmlHandler

overrideAnnotatedClass

public XmlHandler overrideAnnotatedClass(Class<?>... classes)
This method rewrites the xml configuration only if the classes, geiven as input, are configured in annotation and xml..
If the class has inner classes and they are mapped, their configuration will be not rewritten.

Parameters:
classes - Classes to rewrite
Returns:
this instance of XmlHandler

overrideAnnotatedClass

public XmlHandler overrideAnnotatedClass()
This method rewrites the xml configuration of only those classes configured in annotation and xml.

Returns:
this instance of XmlHandler

deleteAnnotatedClasses

public XmlHandler deleteAnnotatedClasses()
Eliminates all classes annotated, from Xml configuration.

Returns:
this instance of XmlHandler

fromXmlToAnnotationAll

public XmlHandler fromXmlToAnnotationAll(Class<?>... classes)
Adds annotations to classes given as input starting from Xml configuration.
If the class has inner classes and they aren't annotated, annotations will be added to them.

Parameters:
classes - classes to convert from xml to annotation
Returns:
this instance of XmlHandler

fromXmlToAnnotation

public XmlHandler fromXmlToAnnotation(Class<?>... classes)
Adds annotations to classes given as input starting from Xml configuration.
If the class has inner classes and they aren't annotated, annotations will be not added to them.

Parameters:
classes - classes to convert from xml to annotation
Returns:
this instance of XmlHandler

fromXmlToAnnotation

public XmlHandler fromXmlToAnnotation()
Adds annotations to all classes presents in the Xml configuration.

Returns:
this instance of XmlHandler

addAttributes

public XmlHandler addAttributes(Class<?> aClass,
                                Attribute... attributes)
Adds attributes to the existent Class in the Xml configuration.

Parameters:
aClass - Class of the attributes
attributes - attributes of the clazz to add in the Xml Configuration File
Returns:
this instance of XmlHandler

deleteAttributes

public XmlHandler deleteAttributes(Class<?> aClass,
                                   String... attributes)
Deletes attributes to the existent Class in the Xml configuration.

Parameters:
aClass - Class of the attributes
attributes - attributes of the clazz to delete from Xml Configuration File
Returns:
this instance of XmlHandler

addClass

public XmlHandler addClass(Class<?> clazz,
                           String... attributes)
This method adds a specific Class to Xml Configuration File.
At least one field name must be configured.

Parameters:
clazz - a Class to add in xml configuration
attributes - configured fields of clazz
Returns:
this instance of XmlHandler

addClass

public XmlHandler addClass(Class<?> clazz,
                           Attribute... attributes)
This method adds a specific Class to Xml Configuration File.
At least one field must be configured.

Parameters:
clazz - a Class to add in xml configuration
attributes - configured fields of clazz
Returns:
this instance of XmlHandler

deleteClass

public XmlHandler deleteClass(Class<?>... classes)
This method remove the classes given as input, from xml mapping File.

Parameters:
classes - classes to delete
Returns:
this instance of XmlHandler

overrideClass

public XmlHandler overrideClass(Class<?> aClass,
                                Attribute... attributes)
This method rewrite a configuration of the Class given as input, with this attributes.

Parameters:
aClass - a Class to override
attributes - attributes of aClass
Returns:
this instance of XmlHandler

getXML

public XML getXML()
For debug porpouse

Returns:
the xml object


Copyright © 2013. All Rights Reserved.