|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.keepondreaming.xml.ClassNameMappingObjectStrategy
public class ClassNameMappingObjectStrategy
Resolves interfaces and attributes via a Properties
mapping.
If the mapping does not resolve the strategy can be configured via the constructor
ClassNameMappingObjectStrategy(Properties, boolean)
to use a backup
strategy, usually ProxyObjectStrategy
Property mappings are as follows:
i.e. de.keepondreaming.xml.example.Root=de.keepondreaming.xml.example.impl.RootImpl
i.e. de.package.MyClass.UGLY_XML_TAG_NAME=getNiceNamedMethod
i.e. de.package.MyClassImpl.UGLY_XML_TAG_NAME=setNiceNamedMethodWithOtherName
$Author: wintermond $ $Date: 2005/07/10 18:38:43 $ $Log: ClassNameMappingObjectStrategy.java,v $ Revision 1.1 2005/07/10 18:38:43 wintermond Renamed ImplObjectStrategy to ClassNameMappingStrategy Performance improvements Revision 1.2 2005/07/09 09:56:38 wintermond Javadoc and implemented ProxyClassCreator. Backupstrategy now more generic
Constructor Summary | |
---|---|
ClassNameMappingObjectStrategy(java.util.Properties mappings)
Default constructor |
|
ClassNameMappingObjectStrategy(java.util.Properties mappings,
boolean useProxyMapping)
Constructor, specifying if in case of insufficient mapping information the call should get passed to the backup strategy |
Method Summary | |
---|---|
java.lang.Object |
createInstance(java.lang.Class clazz)
Creates an instance of the type clazz . |
java.lang.String |
getMethodName(java.lang.Class clazz,
java.lang.String attribute,
boolean set)
Returns the get/set method name for an attribute read by the parser |
void |
init()
Restore initial state |
java.lang.Class |
resolveInterface(java.lang.Object object)
Determines the interfaces this object was created upon. |
void |
setAttribute(java.lang.Object target,
java.lang.String attribute,
java.lang.Object value)
Sets the attribute on an instance returned via ObjectStrategy.createInstance(Class)
target and attribute are guaranteed to be not null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassNameMappingObjectStrategy(java.util.Properties mappings)
mappings
- Must not be null;public ClassNameMappingObjectStrategy(java.util.Properties mappings, boolean useProxyMapping)
mappings
- useProxyMapping
- Method Detail |
---|
public java.lang.Object createInstance(java.lang.Class clazz)
ObjectStrategy
clazz
.
clazz
is never null
createInstance
in interface ObjectStrategy
clazz
.public void setAttribute(java.lang.Object target, java.lang.String attribute, java.lang.Object value)
ObjectStrategy
ObjectStrategy.createInstance(Class)
target
and attribute
are guaranteed to be not null.
value
is guaranteed to be not null if called by the parser
setAttribute
in interface ObjectStrategy
target
- Object to set the attribute toattribute
- Attribute namevalue
- value to setpublic void init()
ObjectStrategy
init
in interface ObjectStrategy
public java.lang.Class resolveInterface(java.lang.Object object)
ObjectStrategy
resolveInterface
in interface ObjectStrategy
object
- Object created by ObjectStrategy.createInstance(Class)
of this object
public java.lang.String getMethodName(java.lang.Class clazz, java.lang.String attribute, boolean set)
ObjectStrategy
getMethodName
in interface ObjectStrategy
set
- true if set method is requested, false if get
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |