it.avutils.jmapper.util
Class XML

java.lang.Object
  extended by it.avutils.jmapper.util.XML

public final class XML
extends Object

XML exposes utility methods for managing the XML file.

Author:
Alessandro Vurro

Constructor Summary
XML()
          Default behavior
XML(boolean atRuntime, String xmlPath)
          Xml file can be loaded in two ways: at runtime and development time.
 
Method Summary
 XML addAnnotatedClass(Class<?> aClass)
          This method adds to the xml configuration file, the class given in input.
 XML addAttributes(Class<?> aClass, Attribute[] attributes)
          This method adds the attributes to an existing Class.
 XML addClass(Class<?> aClass, Attribute[] attributes)
          This method adds Class and attributes to xmlJmapper object.
 boolean attributeExists(Class<?> aClass, Attribute attribute)
          This method returns true if the attribute exist in the Class given in input, returns false otherwise.
 Map<String,List<Attribute>> attributesLoad()
           
 Map<String,List<ConversionMethod>> conversionsLoad()
           
 XML deleteAttributes(Class<?> aClass, String[] attributes)
          This method deletes the attributes to an existing Class.
 XML deleteClass(Class<?> aClass)
          This method remove a specific Class from Xml Configuration File
 boolean exists()
          True if xml path has been defined, false otherwise.
 List<String> getClasses()
          Returns a list with the classes names presents in xml mapping file.
 String getXmlPath()
          Returns the xml path of this object.
 XML setXmlPath(String aXmlPath)
          Setting of xml path.
 XML write()
          Writes the xml mapping file starting from xmlJmapper object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML

public XML(boolean atRuntime,
           String xmlPath)
    throws MalformedURLException,
           IOException
Xml file can be loaded in two ways: at runtime and development time.

Parameters:
atRuntime - true if xml file must be loaded at runtime, false at development time
xmlPath - path of xml file
Throws:
IOException
MalformedURLException

XML

public XML()
Default behavior

Method Detail

getXmlPath

public String getXmlPath()
Returns the xml path of this object.

Returns:
xml path

exists

public boolean exists()
True if xml path has been defined, false otherwise.

Returns:
true if xml path has been defined, false otherwise

setXmlPath

public XML setXmlPath(String aXmlPath)
Setting of xml path.

Parameters:
aXmlPath - xml path
Returns:
this instance of XML

attributesLoad

public Map<String,List<Attribute>> attributesLoad()
Returns:
a Map with class name as key and a list of Attributes as value

conversionsLoad

public Map<String,List<ConversionMethod>> conversionsLoad()
Returns:
a Map with class name as key and a list of Conversions as value

getClasses

public List<String> getClasses()
Returns a list with the classes names presents in xml mapping file.

Returns:
a list with the classes names presents in xml mapping file

write

public XML write()
Writes the xml mapping file starting from xmlJmapper object.

Returns:
this instance of XML

addAnnotatedClass

public XML addAnnotatedClass(Class<?> aClass)
This method adds to the xml configuration file, the class given in input.

Parameters:
aClass - add This Class to Xml Configuration file
Returns:
this instance

addClass

public XML addClass(Class<?> aClass,
                    Attribute[] attributes)
This method adds Class and attributes to xmlJmapper object.
It's mandatory define at least one attribute.

Parameters:
aClass - Class to adds
attributes - attributes of Class
Returns:
this instance

deleteClass

public XML deleteClass(Class<?> aClass)
This method remove a specific Class from Xml Configuration File

Parameters:
aClass -
Returns:
this instance of XML

addAttributes

public XML addAttributes(Class<?> aClass,
                         Attribute[] attributes)
This method adds the attributes to an existing Class.

Parameters:
aClass -
attributes -
Returns:
this instance of XML

deleteAttributes

public XML deleteAttributes(Class<?> aClass,
                            String[] attributes)
This method deletes the attributes to an existing Class.

Parameters:
aClass -
attributes -
Returns:
this instance of XML

attributeExists

public boolean attributeExists(Class<?> aClass,
                               Attribute attribute)
This method returns true if the attribute exist in the Class given in input, returns false otherwise.

Parameters:
aClass - Class of the Attribute
attribute - Attribute to check
Returns:
true if attribute exist, false otherwise


Copyright © 2013. All Rights Reserved.