it.avutils.jmapper
Class RelationalJMapper<T>

java.lang.Object
  extended by it.avutils.jmapper.RelationalJMapper<T>
Type Parameters:
T - Type of Configured Class
All Implemented Interfaces:
IRelationalJMapper<T>

public final class RelationalJMapper<T>
extends Object
implements IRelationalJMapper<T>

RelationalJMapper takes as input one configured Class.
For configured Class, we mean a Class that contains fields configured with annotation or XML.
It is mandatory that all fields have defined classes.
For example:

class Destination {
 
   @JMap(  attributes={"field1Class1","field1Class2","field1Class3"}, 
          classes={Class1.class,Class2.class,Class3.class})
         private String field1;
   @JMap(  attributes={"field2Class1","field2Class2","field2Class3"}, 
          classes={Class1.class,Class2.class,Class3.class})
         private String field2;
   @JMap(  attributes={"field3Class1","field3Class2","field3Class3"}, 
          classes={Class1.class,Class2.class,Class3.class})
         private String field3;
  
  // getter and setter
 }
then invoke the methods manyToOne or oneToMany.

With manyToOne method, the mapped classes are the source and the configured Class is the destination.
manyToOne example:
    AnnotatedClass manyToOne = null;
        Class1 class1 = new Class1("field1Class1", "field2Class1", "field3Class1");
        Class2 class2 = new Class2("field1Class2", "field2Class2", "field3Class2");
        Class3 class3 = new Class3("field1Class3", "field2Class3", "field3Class3");

        RelationalJMapper rm = new RelationalJMapper(AnnotatedClass.class);

        manyToOne = rm.manyToOne(class1);
        manyToOne = rm.manyToOne(class2);
        manyToOne = rm.manyToOne(class3);
With oneToMany method, the mapped classes are the destination and the configured Class is the source.
oneToMany example:
    AnnotatedClass annotatedClass = new AnnotatedClass("field1", "field2", "field3");

        RelationalJMapper rm = new RelationalJMapper(AnnotatedClass.class);

        Class1 class1 = rm.setDestinationClass(Class1.class).oneToMany(annotatedClass);
        Class2 class2 = rm.setDestinationClass(Class2.class).oneToMany(annotatedClass);
        Class3 class3 = rm.setDestinationClass(Class3.class).oneToMany(annotatedClass);
For more information see manyToOne and oneToMany Methods

Author:
Alessandro Vurro

Constructor Summary
RelationalJMapper(Class<T> configuredClass)
          Takes in input only the annotated Class
RelationalJMapper(Class<T> configuredClass, String xmlPath)
          Takes in input only the configured Class and the xml mapping path.
 
Method Summary
<S> T
manyToOne(S source)
          This method returns a new instance of Configured Class with this setting: NullPointerControlSOURCE MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<S> T
manyToOne(S source, MappingType mtSource)
          This method returns a new instance of Configured Class with this setting: NullPointerControlSOURCE MappingType of DestinationALL_FIELDS MappingType of SourcemtSource
<S> T
manyToOne(S source, NullPointerControl nullPointerControl, MappingType mtSource)
          This method returns a new instance of Configured Class with this setting: NullPointerControlnullPointerControl MappingType of DestinationALL_FIELDS MappingType of SourcemtSource
<S> T
manyToOne(T destination, S source)
          This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting: NullPointerControlALL MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<S> T
manyToOne(T destination, S source, MappingType mtDestination, MappingType mtSource)
          This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting: NullPointerControlALL MappingType of DestinationmtDestination MappingType of SourcemtSource
<S> T
manyToOne(T destination, S source, NullPointerControl nullPointerControl, MappingType mtDestination, MappingType mtSource)
          This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting: NullPointerControlnullPointerControl MappingType of DestinationmtDestination MappingType of SourcemtSource
<S> T
manyToOneWithoutControl(S source)
          This method returns a new instance of Configured Class with this setting: NullPointerControlNOT_ANY MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<S> T
manyToOneWithoutControl(T destination, S source)
          This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting: NullPointerControlNOT_ANY MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<D> D
oneToMany(Class<D> destinationClass, T source)
          This method returns a new instance of Target Class with this setting: NullPointerControlSOURCE MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<D> D
oneToMany(Class<D> destinationClass, T source, MappingType mtSource)
          This method returns a new instance of Target Class with this setting: NullPointerControlSOURCE MappingType of DestinationALL_FIELDS MappingType of SourcemtSource
<D> D
oneToMany(Class<D> destinationClass, T source, NullPointerControl nullPointerControl, MappingType mtSource)
          This method returns a new instance of Target Class with this setting: NullPointerControlnullPointerControl MappingType of DestinationALL_FIELDS MappingType of SourcemtSource
<D> D
oneToMany(D destination, T source)
          This Method returns the destination given in input enriched with data contained in source given in input
with this setting: NullPointerControlALL MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<D> D
oneToMany(D destination, T source, MappingType mtDestination, MappingType mtSource)
          This Method returns the destination given in input enriched with data contained in source given in input
with this setting: NullPointerControlALL MappingType of DestinationmtDestination MappingType of SourcemtSource
<D> D
oneToMany(D destination, T source, NullPointerControl nullPointerControl, MappingType mtDestination, MappingType mtSource)
          This Method returns the destination given in input enriched with data contained in source given in input
with this setting: NullPointerControlnullPointerControl MappingType of DestinationmtDestination MappingType of SourcemtSource
<D> D
oneToManyWithoutControl(Class<D> destinationClass, T source)
          This method returns a new instance of Target Class with this setting: NullPointerControlNOT_ANY MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
<D> D
oneToManyWithoutControl(D destination, T source)
          This Method returns the destination given in input enriched with data contained in source given in input
with this setting: NullPointerControlNOT_ANY MappingType of DestinationALL_FIELDS MappingType of SourceALL_FIELDS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationalJMapper

public RelationalJMapper(Class<T> configuredClass)
Takes in input only the annotated Class

Parameters:
configuredClass -

RelationalJMapper

public RelationalJMapper(Class<T> configuredClass,
                         String xmlPath)
Takes in input only the configured Class and the xml mapping path.

Parameters:
configuredClass -
xmlPath - XML path
Method Detail

manyToOne

public <S> T manyToOne(S source)
This method returns a new instance of Configured Class with this setting:
NullPointerControlSOURCE
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
source - instance of Target Class type that contains the data
Returns:
new instance of Configured Class
See Also:
NullPointerControl, MappingType

manyToOneWithoutControl

public <S> T manyToOneWithoutControl(S source)
This method returns a new instance of Configured Class with this setting:
NullPointerControlNOT_ANY
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
manyToOneWithoutControl in interface IRelationalJMapper<T>
Parameters:
source - instance of Target Class type that contains the data
Returns:
new instance of Configured Class
See Also:
NullPointerControl, MappingType

manyToOne

public <S> T manyToOne(T destination,
                       S source)
This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting:
NullPointerControlALL
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
destination - instance of Configured Class type to enrich
source - instance of Target Class type that contains the data
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

manyToOneWithoutControl

public <S> T manyToOneWithoutControl(T destination,
                                     S source)
This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting:
NullPointerControlNOT_ANY
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
manyToOneWithoutControl in interface IRelationalJMapper<T>
Parameters:
destination - instance of Configured Class type to enrich
source - instance of Target Class type that contains the data
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

manyToOne

public <S> T manyToOne(S source,
                       MappingType mtSource)
This method returns a new instance of Configured Class with this setting:
NullPointerControlSOURCE
MappingType of DestinationALL_FIELDS
MappingType of SourcemtSource

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
source - instance of Target Class type that contains the data
mtSource - type of mapping of source instance
Returns:
new instance of Configured Class
See Also:
NullPointerControl, MappingType

manyToOne

public <S> T manyToOne(S source,
                       NullPointerControl nullPointerControl,
                       MappingType mtSource)
This method returns a new instance of Configured Class with this setting:
NullPointerControlnullPointerControl
MappingType of DestinationALL_FIELDS
MappingType of SourcemtSource

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
source - instance of Target Class type that contains the data
nullPointerControl - type of null pointer control
mtSource - type of mapping of source instance
Returns:
new instance of Configured Class
See Also:
NullPointerControl, MappingType

manyToOne

public <S> T manyToOne(T destination,
                       S source,
                       MappingType mtDestination,
                       MappingType mtSource)
This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting:
NullPointerControlALL
MappingType of DestinationmtDestination
MappingType of SourcemtSource

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
destination - instance of Configured Class type to enrich
source - instance of Target Class type that contains the data
mtDestination - type of mapping of destination instance
mtSource - type of mapping of source instance
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

manyToOne

public <S> T manyToOne(T destination,
                       S source,
                       NullPointerControl nullPointerControl,
                       MappingType mtDestination,
                       MappingType mtSource)
This Method returns the configured instance given in input enriched with data contained in source given in input
with this setting:
NullPointerControlnullPointerControl
MappingType of DestinationmtDestination
MappingType of SourcemtSource

Specified by:
manyToOne in interface IRelationalJMapper<T>
Parameters:
destination - instance of Configured Class type to enrich
source - instance of Target Class type that contains the data
nullPointerControl - type of null pointer control
mtDestination - type of mapping of destination instance
mtSource - type of mapping of source instance
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(Class<D> destinationClass,
                       T source)
This method returns a new instance of Target Class with this setting:
NullPointerControlSOURCE
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
destinationClass - class to create
source - instance of Configured Class that contains the data
Returns:
new instance of Target Class
See Also:
NullPointerControl, MappingType

oneToManyWithoutControl

public <D> D oneToManyWithoutControl(Class<D> destinationClass,
                                     T source)
This method returns a new instance of Target Class with this setting:
NullPointerControlNOT_ANY
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
oneToManyWithoutControl in interface IRelationalJMapper<T>
Parameters:
source - instance of Configured Class that contains the data
Returns:
new instance of Target Class
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(D destination,
                       T source)
This Method returns the destination given in input enriched with data contained in source given in input
with this setting:
NullPointerControlALL
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
destination - instance of Target Class to enrich
source - instance of Configured Class that contains the data
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

oneToManyWithoutControl

public <D> D oneToManyWithoutControl(D destination,
                                     T source)
This Method returns the destination given in input enriched with data contained in source given in input
with this setting:
NullPointerControlNOT_ANY
MappingType of DestinationALL_FIELDS
MappingType of SourceALL_FIELDS

Specified by:
oneToManyWithoutControl in interface IRelationalJMapper<T>
Parameters:
destination - instance of Target Class to enrich
source - instance of Configured Class that contains the data
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(Class<D> destinationClass,
                       T source,
                       MappingType mtSource)
This method returns a new instance of Target Class with this setting:
NullPointerControlSOURCE
MappingType of DestinationALL_FIELDS
MappingType of SourcemtSource

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
destinationClass - class to create
source - instance of Configured Class that contains the data
mtSource - type of mapping of source instance
Returns:
new instance of Target Class
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(Class<D> destinationClass,
                       T source,
                       NullPointerControl nullPointerControl,
                       MappingType mtSource)
This method returns a new instance of Target Class with this setting:
NullPointerControlnullPointerControl
MappingType of DestinationALL_FIELDS
MappingType of SourcemtSource

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
source - instance of Configured Class that contains the data
nullPointerControl - type of control
mtSource - type of mapping of source instance
Returns:
new instance of Target Class
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(D destination,
                       T source,
                       MappingType mtDestination,
                       MappingType mtSource)
This Method returns the destination given in input enriched with data contained in source given in input
with this setting:
NullPointerControlALL
MappingType of DestinationmtDestination
MappingType of SourcemtSource

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
destination - instance of Target Class to enrich
source - instance of Configured Class that contains the data
mtDestination - type of mapping of destination instance
mtSource - type of mapping of source instance
Returns:
destination enriched
See Also:
NullPointerControl, MappingType

oneToMany

public <D> D oneToMany(D destination,
                       T source,
                       NullPointerControl nullPointerControl,
                       MappingType mtDestination,
                       MappingType mtSource)
This Method returns the destination given in input enriched with data contained in source given in input
with this setting:
NullPointerControlnullPointerControl
MappingType of DestinationmtDestination
MappingType of SourcemtSource

Specified by:
oneToMany in interface IRelationalJMapper<T>
Parameters:
destination - instance of Target Class to enrich
source - instance of Configured Class that contains the data
nullPointerControl - type of null pointer control
mtDestination - type of mapping of destination instance
mtSource - type of mapping of source instance
Returns:
destination enriched
See Also:
NullPointerControl, MappingType


Copyright © 2013. All Rights Reserved.