com.bmc.arsys.api
Class ExtendedClassRegistry
java.lang.Object
com.bmc.arsys.api.ExtendedClassRegistry
public final class ExtendedClassRegistry
- extends Object
ExtendedClassRegistry
acts as a registration mechanism for client programs to designate their own
implementation classesthat extend AR System Java API classes (i.e. classes in com.bmc.arsys.api package, for
example ActiveLink, AttachmentInfo, AssignFilterApiInfo and so on).
Such registration would allow AR System API implementation to instantiate the user prefered extended type objects as
needed, instead of its own raw types. For example, if a client extends ActiveLink class (say as ActiveLinkEx) and
registers it with Java API using ExtendedClassRegistry
; then the Java API would instantiate an
ActiveLinkEx object (instead of the typical ActiveLink) during ActiveLinkFactory.find(),
ActiveLinkFactory.findObjects() etc.
In order for a user prefered extended type suitable for registering, it must meet the requirements listed below:
- extends a specific Java API class or its descendent
- Optionally implements
ExtendedClassCallbackHandler
- has an no-arguments (defaut) constructor
Following Java code snippet shows an example usage:
//Instantiate a registry... ExtendedClassRegistry registry = new ExtendedClassRegistry(); //... register extended
types... registry.registerExtendedClass(ActiveLink.class, ActiveLinkEx.class); // ActiveLinkEx above is your own
class that extends ActiveLink. registry.registerExtendedClass(WorkflowConnectInfo.class,
WorkflowConnectInfoEx.class); registry.registerExtendedClass(Attachment.class, AttachmentEx.class);
registry.registerExtendedClass(ActiveLinkActionInfo.class, ActiveLinkActionInfoEx.class); // Above xxxEx classes
extend corresponding xxx Java API class // These extending classes optionally can implement
ExtendedClassCallbackHandler
interface. //... attach this registry to your ARServerUser object...
ARServerUser su = new ARServerUser("", "", "", ""); su.setExtendedClassRegistry(ecr); //
... now issue AR System API calls as usual ... ActiveLinkCriteria criteria = new ActiveLinkCriteria();
criteria.setRetrieveAll(true); // Here, observe that we're receiving an ActiveLinkEx from Java API ActiveLinkEx
actLink = ActiveLinkFactory.findByKey(su, "", criteria); WorkflowObjectListCriteria listCriteria = new
WorkflowObjectListCriteria (); // Here, observe that we're receiving an ActiveLinkEx[] from Java API ActiveLinkEx[]
actLinks = ActiveLinkFactory.findObjects(su, listCriteria, criteria);
Method Summary |
|
copy(Class clazz,
T dest,
T src)
|
|
copyArray(T[] array,
boolean onlyIfExtended)
|
|
copyList(List<T> list,
boolean onlyIfExtended)
|
|
copyMap(Map<K,V> map,
boolean onlyIfExtended)
|
boolean |
isExtendingClassRegistered(Class c)
|
|
newInstance(Class<T> clazz)
|
static
|
newInstance(ExtendedClassRegistry ecr,
Class<T> clazz)
|
|
newInstance(T src)
|
|
newInstanceArray(Class<T> clazz,
int size)
|
static
|
newInstanceArray(ExtendedClassRegistry ecr,
Class<T> clazz,
int size)
|
void |
registerExtendedClass(Class<?> clazz,
Class<?> extendedClazz)
|
ExtendedClassRegistry
public ExtendedClassRegistry()
isExtendingClassRegistered
public boolean isExtendingClassRegistered(Class c)
registerExtendedClass
public void registerExtendedClass(Class<?> clazz,
Class<?> extendedClazz)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
newInstanceArray
public static <T> T[] newInstanceArray(ExtendedClassRegistry ecr,
Class<T> clazz,
int size)
throws IllegalAccessException,
InstantiationException
- Throws:
IllegalAccessException
InstantiationException
newInstanceArray
public <T> T[] newInstanceArray(Class<T> clazz,
int size)
throws IllegalAccessException,
InstantiationException
- Throws:
IllegalAccessException
InstantiationException
newInstance
public static <T> T newInstance(ExtendedClassRegistry ecr,
Class<T> clazz)
newInstance
public <T> T newInstance(Class<T> clazz)
newInstance
public <T> T newInstance(T src)
copy
public <T> void copy(Class clazz,
T dest,
T src)
copyArray
public <T> Object copyArray(T[] array,
boolean onlyIfExtended)
copyList
public <T> Object copyList(List<T> list,
boolean onlyIfExtended)
copyMap
public <K,V> Object copyMap(Map<K,V> map,
boolean onlyIfExtended)
throws IllegalAccessException,
InstantiationException
- Throws:
IllegalAccessException
InstantiationException
© Copyright 2006, 2007 BMC Software, Inc.