net.dpml.metro.data
Class ValueDirective

java.lang.Object
  extended bynet.dpml.lang.Construct
      extended bynet.dpml.metro.data.ValueDirective
All Implemented Interfaces:
Directive, Serializable, Value

public final class ValueDirective
extends Construct
implements Directive

A ValueDirective represents a single constructed argument value. The directive holds a classname (default value of java.lang.String) and possible sub-directives. The directives value is established by creating a new instance using the classname together with the values directived from the sub-sidiary directives as constructor arguments.

XML

A value is a nested structure containing a string value or contructor parameter arguments.

    <-- Simple string param declaration -->

    <value>London</value>

    <-- Typed value declaration -->

    <value class="java.io.File">./home</value>

    <-- Multi-argument parameter declaration -->

    <value class="MyClass">
       <value class="java.io.File">./home</value>
       <value>London</value>
    </value>
 

Version:
1.0.0
Author:
Digital Product Meta Library
See Also:
Serialized Form

Constructor Summary
ValueDirective(String value)
          Create a new construct using the default java.lang.String class as the base type.
ValueDirective(String target, String value)
          Create a new construct using a supplied target defintion.
ValueDirective(String target, String method, String value)
          Create a new construct using a supplied target defintion.
ValueDirective(String target, String method, Value[] args)
          Create a new construct using a supplied target defintion.
ValueDirective(String target, Value[] args)
          Create a new construct using a supplied target defintion.
 
Method Summary
 boolean equals(Object other)
          Test if the supplied object is equal to this object.
 URI getPartHandlerURI()
          Return the part handler uri.
 int hashCode()
          Return the hashcode for the instance.
protected static URI setupURI(String spec)
          Internal utility to create a static uri.
 
Methods inherited from class net.dpml.lang.Construct
getArgs, getBaseValue, getMethodName, getTargetExpression, getValues, isCompound, resolve, resolve, resolve, resolve, resolve, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueDirective

public ValueDirective(String value)
Create a new construct using the default java.lang.String class as the base type.

Parameters:
value - the construct value

ValueDirective

public ValueDirective(String target,
                      String value)
Create a new construct using a supplied target defintion. The target argument may be either a classname or a symbolic reference in the form ${[key]}. If the argument is symbolic it resolved relative to a context map supplied by the application resolving construct values.

Parameters:
target - a classname or symbolic reference
value - the construct value

ValueDirective

public ValueDirective(String target,
                      String method,
                      String value)
Create a new construct using a supplied target defintion. The target argument may be either a classname or a symbolic reference in the form ${[key]}. If the argument is symbolic it is resolved relative to a context map supplied by the application resolving construct values. If the construct value is symbolic the implementation will attempt to expand the reference relative to a context map (if supplied) otherwise the implementation will attempt to expand the value using system properties.

Parameters:
target - a classname or symbolic reference
method - the method to invoke on the target
value - the construct value

ValueDirective

public ValueDirective(String target,
                      Value[] args)
Create a new construct using a supplied target defintion. The target argument may be either a classname or a symbolic reference in the form ${[key]}. If the argument is symbolic it is resolved relative to a context map supplied by the application resolving construct values. Instance values resolved from the supplied Value[] will be used as constructor arguments when resolving the target.

Parameters:
target - the construct classname
args - an array of unresolved parameter values

ValueDirective

public ValueDirective(String target,
                      String method,
                      Value[] args)
Create a new construct using a supplied target defintion. The target argument may be either a classname or a symbolic reference in the form ${[key]}. If the argument is symbolic it is resolved relative to a context map supplied by the application resolving construct values. Instance values resolved from the supplied Value[] will be used as method arguments when resolving the target.

Parameters:
target - the construct classname
method - the method to invoke on the target
args - an array of unresolved parameter values
Method Detail

equals

public boolean equals(Object other)
Test if the supplied object is equal to this object.

Overrides:
equals in class Construct
Parameters:
other - the object to compare with this instance
Returns:
TRUE if the supplied object is equal to this object

hashCode

public int hashCode()
Return the hashcode for the instance.

Overrides:
hashCode in class Construct
Returns:
the instance hashcode

getPartHandlerURI

public URI getPartHandlerURI()
Return the part handler uri.

Returns:
the uri of the part handler

setupURI

protected static URI setupURI(String spec)
Internal utility to create a static uri.

Parameters:
spec - the uri spec
Returns:
the uri