|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jdbcimporter.util.CustomObjectFactory
The CustomObjectFactory class is a factory for custom objects. The factory can also apply properties to the custom object via Java Bean setter methods.
Field Summary | |
protected java.util.Map |
mapping
The mapping between types and implementation class names. |
protected java.lang.Class |
objBaseClass
The base interface or class for all custom object created. |
Constructor Summary | |
CustomObjectFactory(java.lang.Class objClass)
Creates a new custom object factory that will create objects of the given class. |
Method Summary | |
void |
addMapping(java.lang.String prefix,
java.lang.String className)
Add a mapping of a short prefix to a class name that is an ancestor of the base class. |
protected void |
applyProperty(java.lang.Object obj,
java.lang.String name,
java.lang.String value)
Set the property in the object with the value. |
java.lang.Object |
getObjectImpl(java.lang.String prefix,
java.util.Map properties)
Create a custom object based on the class name mapped to the prefix and apply the properties to the custom object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Map mapping
protected java.lang.Class objBaseClass
Constructor Detail |
public CustomObjectFactory(java.lang.Class objClass)
objClass
- the base class of all custom objectsMethod Detail |
public void addMapping(java.lang.String prefix, java.lang.String className)
prefix
- the string prefixclassName
- the class namepublic java.lang.Object getObjectImpl(java.lang.String prefix, java.util.Map properties) throws InvalidCustomObjectDefException
prefix
- the prefix mappingproperties
- the properties to apply
InvalidCustomObjectDefException
- if the prefix is not mapped,
the class is not an ancestor of the base class or a property could not
be applied to the custom object.protected void applyProperty(java.lang.Object obj, java.lang.String name, java.lang.String value) throws InvalidCustomObjectDefException
obj
- the objectname
- the name of the propertyvalue
- the value
InvalidCustomObjectDefException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |