public class PartialObject extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
PartialObject.PartialClassLoader
Class loader implementation that is used to define and load partial
classes.
|
Modifier and Type | Field and Description |
---|---|
protected Map |
m_mapProperties
Property values for this object.
|
protected static Map<PartialObject.PartialClassLoader,ConcurrentHashMap<String,Class>> |
s_mapPartialClasses
Partial classes cache.
|
protected static Map<ClassLoader,PartialObject.PartialClassLoader> |
s_mapPartialClassLoaders
ClassLoader instances that is used to define and load partial classes.
|
protected static Map<PartialObject.PartialClassLoader,ConcurrentHashMap<String,Constructor>> |
s_mapPartialConstructors
Partial class constructors cache.
|
Constructor and Description |
---|
PartialObject()
Construct a PartialObject instance.
|
PartialObject(Map mapProperties)
Construct a PartialObject instance.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
castReturnValue(org.objectweb.asm.tree.MethodNode mn)
Cast a return value into an appropriate type.
|
protected static void |
copyClassAnnotations(org.objectweb.asm.tree.ClassNode cnSource,
org.objectweb.asm.tree.ClassNode cnTarget)
Copy class-level annotations.
|
static PartialObject |
create(Class clzSource,
PropertySet propertySet,
Map<String,Object> mapProperties)
Create a PartialObject instance based on an already extracted set of
properties.
|
static Object |
create(Object oSource,
PropertySet propertySet)
Create a PartialObject instance.
|
protected static Class |
createClass(org.objectweb.asm.tree.ClassNode cn)
Create partial class based on partial class definition.
|
protected static void |
createConstructors(org.objectweb.asm.tree.ClassNode cn)
Implement partial class constructors.
|
protected static String |
createKey(Class clzSource,
PropertySet propertySet)
Create key for the partial class/constructor cache.
|
static <T> Class |
createPartialClass(Class clzSource,
PropertySet<T> propertySet)
Create a partial class for the specified source class and property set.
|
protected static org.objectweb.asm.tree.MethodNode |
findProperty(org.objectweb.asm.tree.ClassNode cn,
String sName)
Attempt to find a property getter with a given name in the specified
class definitions.
|
protected static org.objectweb.asm.tree.MethodNode |
findProperty(List<org.objectweb.asm.tree.ClassNode> listClassNodes,
String sName)
Attempt to find a property with a given name in one of the specified
class definitions.
|
Object |
get(String sName)
Get a property value.
|
protected static org.objectweb.asm.tree.ClassNode |
getClassNode(Class clz)
Return a class definition for the specified class.
|
static Class |
getPartialClass(Class clzSource,
PropertySet propertySet)
Return a partial class for the specified source class and property set.
|
protected static PartialObject.PartialClassLoader |
getPartialClassLoader()
Return a PartialClassLoader corresponding to the Context ClassLoader.
|
protected static ConcurrentHashMap<String,Class> |
getPartialClassMap(PartialObject.PartialClassLoader loader)
Return the partial class map corresponding to the PartialClassLoader.
|
protected static ConcurrentHashMap<String,Constructor> |
getPartialConstructorMap(PartialObject.PartialClassLoader loader)
Return the partial constructor map corresponding to the PartialClassLoader.
|
protected static boolean |
isMatch(String sMethodName,
String sPropertyName)
Determine if a method represents a property.
|
String |
toString() |
protected static Map<PartialObject.PartialClassLoader,ConcurrentHashMap<String,Class>> s_mapPartialClasses
protected static Map<PartialObject.PartialClassLoader,ConcurrentHashMap<String,Constructor>> s_mapPartialConstructors
protected static Map<ClassLoader,PartialObject.PartialClassLoader> s_mapPartialClassLoaders
protected Map m_mapProperties
public PartialObject()
public PartialObject(Map mapProperties)
mapProperties
- map containing property values for this partial
objectpublic Object get(String sName)
sName
- property namepublic static Object create(Object oSource, PropertySet propertySet)
oSource
- object to extract properties frompropertySet
- properties to extractpublic static PartialObject create(Class clzSource, PropertySet propertySet, Map<String,Object> mapProperties)
clzSource
- class of the object properties were extracted frompropertySet
- extracted propertiesmapProperties
- extracted property valuespublic static Class getPartialClass(Class clzSource, PropertySet propertySet)
clzSource
- source class to base the partial class onpropertySet
- a set of properties to definepublic static <T> Class createPartialClass(Class clzSource, PropertySet<T> propertySet)
clzSource
- a source class to base partial the class onpropertySet
- a set of properties to defineprotected static String createKey(Class clzSource, PropertySet propertySet)
clzSource
- source class to base the partial class onpropertySet
- a set of properties to defineprotected static void copyClassAnnotations(org.objectweb.asm.tree.ClassNode cnSource, org.objectweb.asm.tree.ClassNode cnTarget)
cnSource
- source class to copy annotations fromcnTarget
- target class to copy annotations toprotected static void createConstructors(org.objectweb.asm.tree.ClassNode cn)
cn
- partial classprotected static void castReturnValue(org.objectweb.asm.tree.MethodNode mn)
mn
- method whose return value needs to be castedprotected static Class createClass(org.objectweb.asm.tree.ClassNode cn)
cn
- partial class definitionprotected static org.objectweb.asm.tree.MethodNode findProperty(List<org.objectweb.asm.tree.ClassNode> listClassNodes, String sName)
listClassNodes
- class definitions to searchsName
- method nameprotected static org.objectweb.asm.tree.MethodNode findProperty(org.objectweb.asm.tree.ClassNode cn, String sName)
cn
- class definition to searchsName
- method nameprotected static boolean isMatch(String sMethodName, String sPropertyName)
sMethodName
- name of the methodsPropertyName
- name of the propertyprotected static org.objectweb.asm.tree.ClassNode getClassNode(Class clz)
clz
- class to get a definition forprotected static PartialObject.PartialClassLoader getPartialClassLoader()
protected static ConcurrentHashMap<String,Class> getPartialClassMap(PartialObject.PartialClassLoader loader)
loader
- the PartialClassLoader corresponding to which the partial class map is requiredprotected static ConcurrentHashMap<String,Constructor> getPartialConstructorMap(PartialObject.PartialClassLoader loader)
loader
- the PartialClassLoader corresponding to which the partial constructor map is required