|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.SIRAPRISE.client.jsba.DBObjectFactory
public abstract class DBObjectFactory
Method Summary | ||
---|---|---|
static
|
getObject(Tuple tuple,
java.lang.Class<C> objectClass)
Get an objects holding the same information as that which is held in this tuple. |
|
static
|
getObject(Tuple tuple,
java.lang.Class<C> objectClass,
java.util.HashMap<java.lang.String,SetterMethod> setterMethods)
Gets an object of the given class, using the given set of setter methods and the attribute values from this tuple |
|
static
|
getObjectArray(AbstractTupleContainer c,
java.lang.Class<C> objectClass)
Get an array of objects holding the same information as that which is held in this TupleContainer. |
|
static
|
getObjectArrayIgnoringMissingSetters(AbstractTupleContainer c,
java.lang.Class<C> objectClass)
Get an array of objects holding a (potentially proper) subset of the information held in this TupleContainer. |
|
static
|
getObjectCollection(AbstractTupleContainer tupleContainer,
java.lang.Class<C> objectClass)
Get a collection of objects holding the same information as that which is held in this TupleContainer. |
|
static
|
getObjectIgnoringMissingSetters(Tuple tuple,
java.lang.Class<C> objectClass)
Get an objects holding the same information as that which is held in this tuple. |
|
static java.util.Map<java.lang.Class<?>,java.lang.Object> |
getObjects(Tuple tuple,
java.lang.Class<?>[] objectClass)
Get a Map of objects holding the same information as that which is held in this Tuple. |
|
static java.lang.reflect.Constructor<?> |
getPublicNoArgConstructor(java.lang.Class<?> objectClass)
Gets the public no-arg constructor from a class |
|
static java.lang.reflect.Constructor<?> |
getPublicTupleConstructor(java.lang.Class<?> objectClass)
Gets the 'Tuple' constructor from a class |
|
static java.util.HashMap<java.lang.String,SetterMethod> |
getSetterMethods(java.lang.Class<?> objectClass,
Heading heading)
Gets the setter methods from a class applicable for the given set of attribute names |
|
static java.util.Map<java.lang.Class<?>,java.lang.Object> |
toObjects(Tuple tuple,
java.util.Map<java.lang.Class<?>,java.util.HashMap<java.lang.String,SetterMethod>> classesProcessingMap)
Gets a Map of objects holding the same information as that which is held in this tuple. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <C> C getObject(Tuple tuple, java.lang.Class<C> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException, SettersMissingException
tuple
- The tuple from which an object is to be builtobjectClass
- A Class object denoting the class of the objects to be returned. objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has a unique setter method for each attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), the attribute name (capitalized), and the suffix "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
SettersMissingException
- if a needed setter is missing in the class denoted by objectClass
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interfacepublic static <C> C[] getObjectArray(AbstractTupleContainer c, java.lang.Class<C> objectClass) throws SettersMissingException, ConstructorMissingException, ClassDoesNotImplementDBObjectException
C
- The name of the objectClass, also naming the class/object type of the objects making up the returned arrayc
- The tuple container whose tuples are to be 'transformed' into objectsobjectClass
- A Class object denoting the class of the objects to be returned. objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has a unique setter method for each attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), followed by the uppercased attribute name (i.e. first character uppercase, all others lowercase), followed by "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
SettersMissingException
- if a needed setter is missing in the class denoted by objectClass
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interfacepublic static <C> C[] getObjectArrayIgnoringMissingSetters(AbstractTupleContainer c, java.lang.Class<C> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException
C
- The name of the objectClass, also naming the class/object type of the objects making up the returned arrayc
- The tuple container whose tuples are to be 'transformed' into objects of the given classobjectClass
- A Class object denoting the class of the objects to be returned. objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has at most one unique setter method for each attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), followed by the uppercased attribute name (i.e. first character uppercase, all others lowercase), followed by "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interface
ConstructorMissingException
ClassDoesNotImplementDBObjectException
public static final <C> C getObjectIgnoringMissingSetters(Tuple tuple, java.lang.Class<C> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException
C
- tuple
- The tuple from which an Object is to be builtobjectClass
- A Class object denoting the class of the objects to be returned. objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has a unique setter method for each attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), the attribute name (capitalized), and the suffix "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interfacepublic static java.util.Map<java.lang.Class<?>,java.lang.Object> getObjects(Tuple tuple, java.lang.Class<?>[] objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException, SettersMissingException
tuple
- The tuple from which objects are to be contructedobjectClass
- An array of Class objects denoting the classes of the objects to be returned for each tuple. Each objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has a unique setter method for some attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), the attribute name (capitalized), and the suffix "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
SettersMissingException
- if some attribute in the heading exists for which no corresponding setter could be found in any of the classes denoted by objectClass[]
ConstructorMissingException
- if objectClass[] contains any class that does not denote a public class, or denotes an abstract class, or does not have a public no-arg constructor
ClassDoesNotImplementDBObjectException
- if objectClass[] contains any class that does not implement the required DBObject interfacepublic static java.lang.reflect.Constructor<?> getPublicNoArgConstructor(java.lang.Class<?> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException
objectClass
- the class
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interfacepublic static java.lang.reflect.Constructor<?> getPublicTupleConstructor(java.lang.Class<?> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException
objectClass
- the class
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public single-arg Tuple constructor
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interfacepublic static java.util.HashMap<java.lang.String,SetterMethod> getSetterMethods(java.lang.Class<?> objectClass, Heading heading)
objectClass
- The class to extract the setter methods fromheading
- The heading of the tuple container, in which to inspect whether an attribute is relation-valued, so that a "relation" setter may also match
public static final <C> C getObject(Tuple tuple, java.lang.Class<C> objectClass, java.util.HashMap<java.lang.String,SetterMethod> setterMethods)
C
- tuple
- The tuple from which an object is to be builtobjectClass
- The Class of the object to be created and returnedsetterMethods
- The setter methods to be invoked to set attribute values in the returned object
public static final java.util.Map<java.lang.Class<?>,java.lang.Object> toObjects(Tuple tuple, java.util.Map<java.lang.Class<?>,java.util.HashMap<java.lang.String,SetterMethod>> classesProcessingMap)
tuple
- The tuple from which objects are to be constrcutedclassesProcessingMap
- The processing map that defines how the conversion of a tuple to a series of objects should proceed. Each entry in the map is a Class object, defining the class of an object to be instantiated for containing values of the tuple. The value mapped to this class object is a Map defining the setter methods to be invoked for setting the appropriate values in the instantiated object.
public static <C> java.util.Collection<C> getObjectCollection(AbstractTupleContainer tupleContainer, java.lang.Class<C> objectClass) throws ConstructorMissingException, ClassDoesNotImplementDBObjectException, SettersMissingException
C
- tupleContainer
- The TupleContainer holding the tuples to be used for constructing DBObjectsobjectClass
- A Class object denoting the class of the objects to be returned. objectClass must denote a public, non-abstract class that has a public no-arg constructor, and that has a unique setter method for each attribute in the heading. The name of this unique method must be the concatenation of the word "set" (all lowercase), followed by the uppercased attribute name (i.e. first character uppercase, all others lowercase), followed by "FromDB". The argument list of this setter method must consist of excatly one java.lang.String argument.
ConstructorMissingException
- if objectClass does not denote a public class, or it denotes an abstract class, or the class does not have a public no-arg constructor
SettersMissingException
- if a needed setter is missing in the class denoted by objectClass
ClassDoesNotImplementDBObjectException
- if objectClass does not implement the required DBObject interface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |