wt.clients.util
Class TaskDelegateFactory
java.lang.Object
wt.clients.util.TaskDelegateFactory
public class TaskDelegateFactory
- extends Object
Class TaskDelegateFactory is a utility class which contains
factory methods for instantiating TaskDelegate objects.
This class instantiates task delegate objects based upon either a given
class or the class of a given object.
The TaskDelegateFactory assumes a specific naming convention
when trying to instantiate a TaskDelegate for a given class or
object. If the fully-qualified class of the business object for which to
instantiate a delegate is mysite.mypackage.MyBusinessObject,
this factory will attempt to find a task delegate class whose
fully-qualified class name is
mysite.clients.mypackage.MyBusinessObjectTaskDelegate. For
example, when attempting to instantiate a task delegate for wt.doc.WTDocument
objects, the factory will look for a class whose fully-qualified name is
wt.clients.doc.WTDocument. Given the fully-qualified class name of
apkg.bpkg.cpkg.dpkg.Eobject, this factory will follow the following
search algorithm to try and find a corresponding task delegate class:
- apkg.clients.bpkg.cpkg.dpkg.EobjectTaskDelegate
- apkg.bpkg.clients.cpkg.dpkg.EobjectTaskDelegate
- apkg.bpkg.cpkg.clients.dpkg.EobjectTaskDelegate
- apkg.bpkg.cpkg.dpkg.clients.EobjectTaskDelegate
If no delegate is found using this algorithm, the same algorithm will be applied
to the parent of the given class. If no delegate is found applying this algorithm
to the parent class, the same algorithm will be applied to the interfaces
implemented by the given class.
The TaskDelegateFactory class together with the
TaskDelegate class form in a system in which business objects
can be created, updated, viewed and deleted without knowing the specific
type of the business object. For example:
public class MyDisplay extends Frame {
...
public void handleViewEvent( Event evt ) {
Object obj_to_view = evt.getSource();
TaskDelegate delegate =
TaskDelegateFactory.instantiateTaskDelegate( obj_to_view );
if( delegate != null ) {
delegate.setParentApplet( getParentApplet() );
delegate.setParentFrame( this );
delegate.setObject( obj_to_view );
try {
delegate.launchViewTask();
} catch (TaskDelegateException tde) {
// Handle Exception
}
}
...
}
Supported API: true
Extendable: false
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |