org.apache.commons.workflow.base
Class BaseDescriptor

java.lang.Object
  extended by org.apache.commons.workflow.base.BaseDescriptor
All Implemented Interfaces:
Descriptor

public class BaseDescriptor
extends Object
implements Descriptor

Basic implementation of the Descriptor interface.

Version:
$Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan

Field Summary
protected  String name
          The name of the Java object (in some scope).
protected  String scope
          The scope of the Java object.
protected  Class type
          The optional Java class expected by this Descriptor.
protected  String xpath
          The XPath expression used to access the Java object.
 
Constructor Summary
BaseDescriptor()
          Create an instance with default values.
BaseDescriptor(String xpath)
          Create an instance with the specified values.
BaseDescriptor(String xpath, Class type)
          Create an instance with the specified values.
BaseDescriptor(String name, String scope)
          Create an instance with the specified values.
BaseDescriptor(String name, String scope, Class type)
          Create an instance with the specified values.
BaseDescriptor(String name, String scope, String xpath, Class type)
          Create an instance with the specified values.
 
Method Summary
 Object get(Context context)
          Return the value specified by this Descriptor from the specified Context.
 String getName()
          Return the name of the Java object (in some scope) referenced by this Descriptor.
 String getScope()
          Return the scope of the Java object referenced by this Descriptor.
 Class getType()
          Return the optional Java class expected by this Descriptor.
 String getXpath()
          Return the XPath expression used to access the Java object referenced by this Descriptor.
 boolean positive(Context context)
          Call get() to retrieve the value specified by this Descriptor, and then return true if this value represents a positive result; otherwise return false.
 void put(Context context, Object value)
          Store the value into the destination specified by this Descriptor in the specified Context, replacing any existing value.
 void remove(Context context)
          Remove any existing value associated with this Descriptor from the specified Context.
 void setName(String name)
          Set the name of the Java object (in some scope) referenced by this Descriptor.
 void setScope(String scope)
          Set the scope of the Java object referenced by this Descriptor.
 void setType(Class type)
          Set the optional Java class expected by this Descriptor.
 void setXpath(String xpath)
          Set the XPath expression used to access the Java object referenced by this Descriptor.
 String toString()
          Render a printable version of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The name of the Java object (in some scope).


scope

protected String scope
The scope of the Java object.


type

protected Class type
The optional Java class expected by this Descriptor.


xpath

protected String xpath
The XPath expression used to access the Java object.

Constructor Detail

BaseDescriptor

public BaseDescriptor()
Create an instance with default values.


BaseDescriptor

public BaseDescriptor(String xpath)
Create an instance with the specified values.

Parameters:
xpath - The XPath reference expression

BaseDescriptor

public BaseDescriptor(String xpath,
                      Class type)
Create an instance with the specified values.

Parameters:
xpath - The XPath reference expression
type - The expected class of this object

BaseDescriptor

public BaseDescriptor(String name,
                      String scope)
Create an instance with the specified values.

Parameters:
name - The object name
scope - The object scope

BaseDescriptor

public BaseDescriptor(String name,
                      String scope,
                      Class type)
Create an instance with the specified values.

Parameters:
name - The object name
scope - The object scope
type - The expected class of this object

BaseDescriptor

public BaseDescriptor(String name,
                      String scope,
                      String xpath,
                      Class type)
Create an instance with the specified values.

Parameters:
name - The object name
scope - The object scope
xpath - The XPath reference expression
type - The expected class
Method Detail

getName

public String getName()
Return the name of the Java object (in some scope) referenced by this Descriptor.

Specified by:
getName in interface Descriptor

setName

public void setName(String name)
Set the name of the Java object (in some scope) referenced by this Descriptor.

Specified by:
setName in interface Descriptor
Parameters:
name - The new object name

getScope

public String getScope()
Return the scope of the Java object referenced by this Descriptor.

Specified by:
getScope in interface Descriptor

setScope

public void setScope(String scope)
Set the scope of the Java object referenced by this Descriptor.

Specified by:
setScope in interface Descriptor
Parameters:
scope - The new scope name

getType

public Class getType()
Return the optional Java class expected by this Descriptor.

Specified by:
getType in interface Descriptor

setType

public void setType(Class type)
Set the optional Java class expected by this Descriptor.

Specified by:
setType in interface Descriptor
Parameters:
type - The new expected type

getXpath

public String getXpath()
Return the XPath expression used to access the Java object referenced by this Descriptor.

Specified by:
getXpath in interface Descriptor

setXpath

public void setXpath(String xpath)
Set the XPath expression used to access the Java object referenced by this Descriptor.

Specified by:
setXpath in interface Descriptor
Parameters:
xpath - The new XPath expression

get

public Object get(Context context)
Return the value specified by this Descriptor from the specified Context. If there is no such value, return null.

Specified by:
get in interface Descriptor
Parameters:
context - Context from which to retrieve this value

positive

public boolean positive(Context context)

Call get() to retrieve the value specified by this Descriptor, and then return true if this value represents a positive result; otherwise return false. A positive result depends on the data type of the retrieved value:

Specified by:
positive in interface Descriptor
Parameters:
context - Context from which to retrieve this value

put

public void put(Context context,
                Object value)
Store the value into the destination specified by this Descriptor in the specified Context, replacing any existing value.

Specified by:
put in interface Descriptor
Parameters:
context - Context into which to store this value
value - Object value to be stored

remove

public void remove(Context context)
Remove any existing value associated with this Descriptor from the specified Context.

Specified by:
remove in interface Descriptor
Parameters:
context - Context from which to remove this value.

toString

public String toString()
Render a printable version of this object.

Overrides:
toString in class Object


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.