|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.fc.ReferenceResolver
Uses introspection and reflection to find the best matching reference class for a given Persistable class.
The public APIs are all thread-safe.
Field Summary | |
private static String |
CLASSNAME
|
private static boolean |
DEBUG
|
static Map |
DEFAULT_OVERRIDES
|
private static DebugWriter |
LOG
|
private static Object |
NO_MATCH
|
private HashMap |
persistableTypesToReferenceTypes
|
private Map |
referenceTypesToPersistableFactoryMethods
|
private Map |
referenceTypesToQueryKeyFactoryMethods
|
Constructor Summary | |
ReferenceResolver(Class root_class)
Creates a ReferenceResolver for all descendents of the given reference class |
|
ReferenceResolver(Class root_class,
Map overrides)
Creates a ReferenceResolver for all descendents of the given reference class |
Method Summary | |
private void |
addTarget(ClassInfo info)
Called by the constructor to build up the persistableTypesToReferenceTypes map |
(package private) static Method |
getFactoryMethod(Class object_class,
Class parameter_class)
Tries to use reflection to get a system-generated factory method for the given object type that has the given parameter type. |
(package private) static String |
getFactoryMethodName(Class reference_class)
Gets the system-generated factory method for the given class |
(package private) static Class |
getPersistableTypeByIntrospection(ClassInfo info)
Tries to use introspection to get the Persistsble object type that corresponds to the given reference type, by looking at the references CONSTRAINED_TYPE property |
WTReference |
getReference(Persistable p)
Create a reference to the given Persistable |
WTReference |
getReference(QueryKey query_key)
Create a reference to the given QueryKey |
Class |
getReferenceClass(Class persistable_class)
Get the Class of WTReference that should be used for instances of the given Persistable class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String CLASSNAME
private static final boolean DEBUG
private static final DebugWriter LOG
private static final Object NO_MATCH
private volatile HashMap persistableTypesToReferenceTypes
private final Map referenceTypesToPersistableFactoryMethods
private final Map referenceTypesToQueryKeyFactoryMethods
public static final Map DEFAULT_OVERRIDES
Constructor Detail |
public ReferenceResolver(Class root_class)
root_class
- The root class that all references
resolved by this instance will be subclasses ofpublic ReferenceResolver(Class root_class, Map overrides)
root_class
- The root class that all references
resolved by this instance will be subclasses ofoverrides
- Mapping of persistable types to reference types
that will override what would have been found
via introspection or reflectionMethod Detail |
public WTReference getReference(Persistable p)
p
-
public WTReference getReference(QueryKey query_key)
query_key
-
public Class getReferenceClass(Class persistable_class)
The implementation uses a copy-on-write strategy to keep this method from paying synchronization costs
persistable_class
- The class of Persistable to find a reference class for.
private void addTarget(ClassInfo info) throws WTException
WTException
static Class getPersistableTypeByIntrospection(ClassInfo info) throws WTException
WTException
static Method getFactoryMethod(Class object_class, Class parameter_class)
object_class
- The class to find a factory method forparameter_class
- The class of parameter the method should have
static String getFactoryMethodName(Class reference_class)
reference_class
- A Class that ObjectReference is assignable from
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |