PREV CLASS NEXT CLASS
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.pcm.events
Class AbstractCachingMapperFactoryjava.lang.Objectcom.ibm.portal.pcm.events.AbstractCachingMapperFactory
- All Implemented Interfaces:
- MapperFactory
public abstract class AbstractCachingMapperFactory- extends java.lang.Object
- implements MapperFactory
Abstract implementation of a caching MapperFactory.
- Since:
- 8.0.0
Constructor Summary AbstractCachingMapperFactory()
Construct a AbstractCachingMapperFactory.
Method Summary ContextToPayloadMapper getContextToPayloadMapper(java.lang.String classname)
Return an instance of the implementation of the specified ContextToPayloadMapper.protected
<T> T getObjectInstance(java.lang.String classname, java.lang.Class<T> type)
Tries to creates a object of the given name.PayloadToContextMapper getPayloadToContextMapper(java.lang.String classname)
Return an instance of the implementation of the specified PayloadToContextMapper.protected abstract java.util.Collection<java.lang.ClassLoader> initClassloaders()
Return a list of classloaders to be used by this MapperFactory.protected void internalClearCache()
Clears the cache.
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail AbstractCachingMapperFactory
public AbstractCachingMapperFactory() throws java.lang.IllegalArgumentException
- Construct a AbstractCachingMapperFactory.
- Throws:
- java.lang.IllegalArgumentException - if the subclass-supplied method initClassloaders() returns invalid results.
Method Detail internalClearCache
protected final void internalClearCache()
- Clears the cache. Can be called by derived classes.
initClassloaders
protected abstract java.util.Collection<java.lang.ClassLoader> initClassloaders()
- Returns a list of classloaders to be used by this MapperFactory.
If the returned list
the construction of the AbstractCachingMapperFactory will fail with an IllegalArgumentException.
- is null
- is empty
- contains a null-entry
The simplest implementation is:
protected Collection<ClassLoader> initClassloaders() { return Collections.singleton(this.getClass().getClassloader()); }
- Returns:
- List of classloaders.
getPayloadToContextMapper
public final PayloadToContextMapper getPayloadToContextMapper(java.lang.String classname)
- Description copied from interface: MapperFactory
- Returns an instance of the implementation of the specified PayloadToContextMapper.
Must not throw an exception if the named class could not be found, instantiated or is of an invalid type. In this cases null must be returned.
If the class was found but could not be instantiated or is of an invalid type, this should be logged.
- Specified by:
- getPayloadToContextMapper in interface MapperFactory
- Parameters:
- classname - Name of the instance to instantiate.
- Returns:
- A PayloadToContextMapper instance associated to given name or null if an instance could not be created.
getContextToPayloadMapper
public final ContextToPayloadMapper getContextToPayloadMapper(java.lang.String classname)
- Description copied from interface: MapperFactory
- Returns an instance of the implementation of the specified ContextToPayloadMapper.
Must not throw an exception if the named class could not be found, instantiated or is of an invalid type. In this cases null must be returned.
If the class was found but could not be instantiated or is of an invalid type, this should be logged.
- Specified by:
- getContextToPayloadMapper in interface MapperFactory
- Parameters:
- classname - Name of the instance to instantiate.
- Returns:
- A ContextToPayloadMapper instance associated with the given name or null if an instance could not be created.
getObjectInstance
protected final <T> T getObjectInstance(java.lang.String classname, java.lang.Class<T> type)PREV CLASS NEXT CLASS
- Tries to creates a object of the given name. It delegates the class loading to the classloaders returned by initClassloaders() during construction of the object. If the class can't be loaded or can't be instantiated, null is returned.
- Parameters:
- classname - The type of object to instantiate.
- type - the created object must be assignable to this type.
- Returns:
- the created object or null if the class could not be found or loaded.
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD