craigmcc 01/08/25 17:17:55 Modified: workflow/src/java/org/apache/commons/workflow Descriptor.java workflow/src/java/org/apache/commons/workflow/base BaseDescriptor.java Log: Extend a Descriptor to include an optional Java class representing the type of object expected to be described by this descriptor. This will be useful when setting up parameter lists for method invocation, where the actual object need only be assignment-compatible with the type expected by the method. Revision Changes Path 1.2 +17 -3 jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/Descriptor.java Index: Descriptor.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/Descriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Descriptor.java 2001/08/26 00:06:51 1.1 +++ Descriptor.java 2001/08/26 00:17:55 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/Descriptor.java,v 1.1 2001/08/26 00:06:51 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/26 00:06:51 $ + * $Header: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/Descriptor.java,v 1.2 2001/08/26 00:17:55 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/08/26 00:17:55 $ * * ==================================================================== * @@ -77,7 +77,7 @@ * evaluation stack of our current <code>Context</code> is consumed.</li> * </ul> * - * @version $Revision: 1.1 $ $Date: 2001/08/26 00:06:51 $ + * @version $Revision: 1.2 $ $Date: 2001/08/26 00:17:55 $ * @author Craig R. McClanahan */ @@ -115,6 +115,20 @@ * @param scope The new scope name */ public void setScope(String scope); + + + /** + * Return the optional Java class expected by this Descriptor. + */ + public Class getType(); + + + /** + * Set the optional Java class expected by this Descriptor. + * + * @param type The new expected type + */ + public void setType(Class type); /** 1.2 +64 -6 jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseDescriptor.java Index: BaseDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BaseDescriptor.java 2001/08/26 00:06:51 1.1 +++ BaseDescriptor.java 2001/08/26 00:17:55 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseDescriptor.java,v 1.1 2001/08/26 00:06:51 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/26 00:06:51 $ + * $Header: /home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseDescriptor.java,v 1.2 2001/08/26 00:17:55 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/08/26 00:17:55 $ * * ==================================================================== * @@ -70,7 +70,7 @@ /** * <p>Basic implementation of the <strong>Descriptor</strong> interface.</p> * - * @version $Revision: 1.1 $ $Date: 2001/08/26 00:06:51 $ + * @version $Revision: 1.2 $ $Date: 2001/08/26 00:17:55 $ * @author Craig R. McClanahan */ @@ -97,7 +97,7 @@ */ public BaseDescriptor(String xpath) { - this(null, null, xpath); + this(null, null, xpath, null); } @@ -105,12 +105,39 @@ /** * Create an instance with the specified values. * + * @param xpath The XPath reference expression + * @param type The expected class of this object + */ + public BaseDescriptor(String xpath, Class type) { + + this(null, null, xpath, type); + + } + + + /** + * Create an instance with the specified values. + * * @param name The object name * @param scope The object scope */ public BaseDescriptor(String name, String scope) { + + this(name, scope, null, null); + + } + + + /** + * Create an instance with the specified values. + * + * @param name The object name + * @param scope The object scope + * @param type The expected class of this object + */ + public BaseDescriptor(String name, String scope, Class type) { - this(name, scope, null); + this(name, scope, null, type); } @@ -121,13 +148,16 @@ * @param name The object name * @param scope The object scope * @param xpath The XPath reference expression + * @param type The expected class */ - public BaseDescriptor(String name, String scope, String xpath) { + public BaseDescriptor(String name, String scope, + String xpath, Class type) { super(); setName(name); setScope(scope); setXpath(xpath); + setType(type); } @@ -148,6 +178,12 @@ /** + * The optional Java class expected by this Descriptor. + */ + protected Class type = null; + + + /** * The XPath expression used to access the Java object. */ protected String xpath = null; @@ -198,6 +234,28 @@ public void setScope(String scope) { this.scope = scope; + + } + + + /** + * Return the optional Java class expected by this Descriptor. + */ + public Class getType() { + + return (this.type); + + } + + + /** + * Set the optional Java class expected by this Descriptor. + * + * @param type The new expected type + */ + public void setType(Class type) { + + this.type = type; }