Advanced Customization > Windchill Adapter > Custom Windchill Adapter Webjects > Implementing Custom Windchill Adapter Webjects > Writing a New Webject Delegate
  
Writing a New Webject Delegate
Most Windchill adapter webjects reside in the com.ptc.core.adapter.server.impl package. For simplicity, the Windchill adapter webjects are not modeled. Most webject subclasses have common parent classes that based on the type of adapter webject.
OBJ webjects typically extend com.ptc.core.adapter.server.impl.ObjectWebject
ACT webjects extend com.ptc.core.adapter.server.impl.ActionWebject
Both ObjectWebject and ActionWebject extend com.ptc.core.adapter.server.impl.AbstractWebject.
Each class provides useful convenience methods and parameter support applicable to the type of webject being written. Subclasses of any of these also inherit the TypeAwareWebjectDelegate interface. Subclasses need only implement the invoke() method.
For a detailed list of methods available to each, refer to the javadoc for com.ptc.core.adapter.server.impl.
Windchill adapter webjects drive parameter gathering and validation by use of core Info*Engine Java annotations. This ensures that all webjects process input parameters as consistently as possible, report consistent error messages, and do not need to duplicate source code for routine tasks.
If you make use of existing super classes (ObjectWebject, ActionWebject, or AbstractWebject), each class defines the parameters that it gathers and uses, so subclasses need only define the parameters that they specifically use that are not already being gathered by a parent class. Webject parameter validation can then perform all basic validation of things such as the following:
Existence of required parameters
Existence of interdependent parameters
Mutually exclusive parameters are not specified together
Parameters conform to the data types they are defined to contain
This leaves only basic parameter validation to the webject implementation itself.
If you decide to extend an existing base class, then the first thing your class should do in its invoke method implementation is to call the parent class' preset method. This validates parameters and gathers common parameters.
If you do not decide to extend a common base class, then you must either force parameter validation yourself (if using annotations) or manually gather parameters from the webject.
The annotations that are used for parameter validation are com.infoengine.object.factory.WebjectDef and com.infoengine.object.factory.ParameterDef.. For more information, see the examples in the following topics.