Class TaskDelegateFactory
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
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
-
Method Summary