ALBPM Process API

fuego.lang
Class DynamicObject

java.lang.Object
  extended by fuego.lang.DynamicObject
All Implemented Interfaces:
ArgumentMap, Serializable, Cloneable

public abstract class DynamicObject
extends Object
implements ArgumentMap

See Also:
Serialized Form

Nested Class Summary
static interface DynamicObject.Dynamizable
          Interface Dynamizable
static class DynamicObject.Quote
          This class allow the quoting of dynamic objects
static class DynamicObject.X
           
 
Field Summary
static DynamicObject NULL
           
static String PARENT_REFERENCE_FIELD
           
 
Constructor Summary
DynamicObject()
           
 
Method Summary
 void addElement(boolean value)
          Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.
 void addElement(double value)
          Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.
 void addElement(long value)
          Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.
 void addElement(Object value)
          Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.
 Map<DynamicObject,DynamicObject> asAssociativeArray()
           
 DynamicObject asDynamicObject()
           
 Map<String,Object> asFieldsMap()
          Returns a view of this DynamicObject as a Map of Fields.
 List<Object> asList()
          Returns a view of this DynamicObject as a List.
 Map<String,Object> asMap()
          Returns a view of this DynamicObject as a Map.
 boolean booleanValue()
          Returns this DynamicObject as a boolean.
 boolean contains(String argumentName)
           
<T> T
convertTo(Class<T> target)
           
<T> T
convertTo(Class<T> target, Class elementType, Map<Object,Object> references)
           
<T> T
convertTo(Class<T> target, Map<Object,Object> references)
          Converts this DynamicObject to the specified target class.
 Object convertTo(Field field)
          Converts this DynamicObject to the specified field type
static DynamicObject create()
          Creates a new DynamicObject that represents a Composite Object.
static DynamicObject createList()
          Creates a new DynamicObject that represents a List
static DynamicObject createMap()
          Creates a new DynamicObject that represents a Map
 BigDecimal decimalValue()
          Returns this BigDecimal as a long.
static DynamicObject defaultValueOf(Object value)
          Returns the DynamicObject representation of the specified argument.
static DynamicObject defaultValueOf(Object value, boolean quote)
           
static DynamicObject defaultValueOf(Object value, boolean quote, Map<Object,Object> references)
           
 double doubleValue()
          Returns this DynamicObject as a double.
 Enum enumValue(Class targetClass)
          Returns this DynamicObject as an Enum.
 boolean equals(Object obj)
          Compares the specified object with this DynamicObject for equality.
<T> T
getArgument(String argumentName, Class<T> argumentClass)
           
 DynamicObject getElement(Object key)
          Returns the element associated with the key if the DynamicObject represents a map.
 DynamicObject getElementAt(int index)
          Returns the nth element if the DynamicObject represents an array.
 Class getElementType()
          Returns element type if it's a list or a map, null otherwise.
 DynamicObject getField(String fieldName)
          Returns the field value corresponding to the specified field name if the DynamicObject represents a Composite.
 Class getIndexType()
          Returns index type if it's a list or a map, null otherwise.
 String getJavaClassName()
          Returns the java class name of the object which represents this DynamicObject.
 Object getPrevious()
           
 int hashCode()
           
 Interval intervalValue()
          Returns this DynamicObject as an Interval.
 int intValue()
          Returns this DynamicObject as an int
 boolean isAssociativeArray()
          Returns true if this DynamicObject represents a Map.
 boolean isBinary()
          Returns true if this DynamicObject represents a Binary.
 boolean isBool()
          Returns true if this DynamicObject represents a Bool.
 boolean isComposite()
          Returns true if this DynamicObject represents a Composite Object.
 boolean isDecimal()
          Returns true if this DynamicObject represents a Decimal.
 boolean isInt()
          Returns true if this DynamicObject represents an Int.
 boolean isInterval()
          Returns true if this DynamicObject represents a Interval.
 boolean isList()
          Returns true if this DynamicObject represents a List.
 boolean isPredefined()
          Returns true if this DynamicObject predefined.
 boolean isQuoted()
          Returns true if this DynamicObject is quoted.
 boolean isReal()
          Returns true if this DynamicObject represents a Real.
 boolean isString()
          Returns true if this DynamicObject represents a String.
 boolean isTime()
          Returns true if this DynamicObject represents a Time.
 long longValue()
          Returns this DynamicObject as a long.
 Object objectValue()
          Returns the Object that best represents this DynamicObject.
 DynamicObject.Quote quote()
          Returns a new Quoted DynamicObject
 void removeElementAt(int index)
          Removes the element at the specified position.
abstract  void serialize(fuego.lang.Serializer serializer)
          Serialize this DynamicObject using the specified Serializer.
 void setArgument(String argumentName, boolean value)
           
 void setArgument(String argumentName, byte value)
           
 void setArgument(String argumentName, char value)
           
 void setArgument(String argumentName, double value)
           
 void setArgument(String argumentName, float value)
           
 void setArgument(String argumentName, int value)
           
 void setArgument(String argumentName, long value)
           
 void setArgument(String argumentName, Object value)
           
 void setArgument(String argumentName, short value)
           
 void setElement(Object key, Object value)
          Associates the specified value with the specified key.
 void setElementAt(int index, Object value)
          Replaces the element located at the specified index with the specified value.
 void setField(String fieldName, boolean value)
          Assigns a value to the specified field.
 void setField(String fieldName, double value)
          Assigns the specified value to the field.
 void setField(String fieldName, long value)
          Assigns the specified value to the field.
 void setField(String fieldName, Object value)
          Assigns a value to the specified field.
 void setFieldQ(String fieldName, Object value)
          Assigns a value to the specified field.
 void setJavaClassName(String classname)
          Sets a java class name to this dynamic object.
 void setPrevious(Object previous)
           
 Time timeValue()
          Returns this DynamicObject as a Time.
static DynamicObject valueOf(boolean value)
          Returns the DynamicObject representation of the specified argument.
static DynamicObject valueOf(double value)
          Returns the DynamicObject representation of the specified argument.
static DynamicObject valueOf(long value)
          Returns the DynamicObject representation of the specified argument.
static DynamicObject valueOf(Object value)
          Returns the DynamicObject representation of the specified argument.
static DynamicObject valueOf(Object value, boolean quote)
           
static DynamicObject valueOf(Object value, boolean quote, Map<Object,Object> references)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARENT_REFERENCE_FIELD

@NonNls
public static final String PARENT_REFERENCE_FIELD
See Also:
Constant Field Values

NULL

public static final DynamicObject NULL
Constructor Detail

DynamicObject

public DynamicObject()
Method Detail

serialize

public abstract void serialize(fuego.lang.Serializer serializer)
Serialize this DynamicObject using the specified Serializer.

Parameters:
serializer -

create

public static DynamicObject create()
Creates a new DynamicObject that represents a Composite Object.

Returns:
a dynamic object.

createList

public static DynamicObject createList()
Creates a new DynamicObject that represents a List

Returns:
a dynamic object.

createMap

public static DynamicObject createMap()
Creates a new DynamicObject that represents a Map

Returns:
a dynamic object

defaultValueOf

public static DynamicObject defaultValueOf(Object value)
Returns the DynamicObject representation of the specified argument.

Parameters:
value - Any object.
Returns:
a DynamicObject

defaultValueOf

public static DynamicObject defaultValueOf(Object value,
                                           boolean quote)

defaultValueOf

public static DynamicObject defaultValueOf(Object value,
                                           boolean quote,
                                           Map<Object,Object> references)

valueOf

public static DynamicObject valueOf(long value)
Returns the DynamicObject representation of the specified argument.

Parameters:
value - A long value.
Returns:
a DynamicObject.

valueOf

public static DynamicObject valueOf(double value)
Returns the DynamicObject representation of the specified argument.

Parameters:
value - A double value.
Returns:
a DynamicObject

valueOf

public static DynamicObject valueOf(boolean value)
Returns the DynamicObject representation of the specified argument.

Parameters:
value - A boolean value.
Returns:
a dynamicObject

valueOf

public static DynamicObject valueOf(Object value)
Returns the DynamicObject representation of the specified argument.

Parameters:
value - An object value.
Returns:
a DynamicObject

valueOf

public static DynamicObject valueOf(Object value,
                                    boolean quote)

valueOf

public static DynamicObject valueOf(Object value,
                                    boolean quote,
                                    Map<Object,Object> references)

getPrevious

public Object getPrevious()

addElement

public final void addElement(Object value)
                      throws UnsupportedOperationException
Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.

Parameters:
value - Value to add.
Throws:
UnsupportedOperationException

addElement

public final void addElement(boolean value)
                      throws UnsupportedOperationException
Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.

Parameters:
value - Value to add.
Throws:
UnsupportedOperationException

addElement

public final void addElement(long value)
                      throws UnsupportedOperationException
Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.

Parameters:
value - value to add.
Throws:
UnsupportedOperationException

addElement

public final void addElement(double value)
                      throws UnsupportedOperationException
Adds the specified value at the end of this DynamicObject if it's a List, otherwise it'll throw an UnsupportedOperationException.

Parameters:
value - value to add.
Throws:
UnsupportedOperationException

asDynamicObject

public final DynamicObject asDynamicObject()
Specified by:
asDynamicObject in interface ArgumentMap

asFieldsMap

public Map<String,Object> asFieldsMap()
                               throws UnsupportedOperationException
Returns a view of this DynamicObject as a Map of Fields. Changes in the returned Map are reflected in this DynamicObject and vice-versa.

Returns:
A view of this DynamicObject as a Map of Fields.
Throws:
UnsupportedOperationException

asList

public List<Object> asList()
                    throws UnsupportedOperationException
Returns a view of this DynamicObject as a List. Changes in the returned List are automatically reflected in this DynamicObject and vice-versa.

Returns:
A view of this DynamicObject as a List.
Throws:
UnsupportedOperationException

asMap

public final Map<String,Object> asMap()
                               throws UnsupportedOperationException
Returns a view of this DynamicObject as a Map. Changes in the returned Map are reflected in this DynamicObject and vice-versa.

Specified by:
asMap in interface ArgumentMap
Returns:
A view of this DynamicObject as a Map.
Throws:
UnsupportedOperationException

booleanValue

public boolean booleanValue()
Returns this DynamicObject as a boolean.

Returns:
The boolean value.

contains

public final boolean contains(String argumentName)
Specified by:
contains in interface ArgumentMap

convertTo

public <T> T convertTo(Class<T> target)

convertTo

public final Object convertTo(Field field)
Converts this DynamicObject to the specified field type

Parameters:
field - field type.
Returns:
an Object

convertTo

public <T> T convertTo(Class<T> target,
                       Map<Object,Object> references)
Converts this DynamicObject to the specified target class.

Parameters:
target -
Returns:
an Object of the specified class

convertTo

public <T> T convertTo(Class<T> target,
                       Class elementType,
                       Map<Object,Object> references)

setPrevious

public void setPrevious(Object previous)

decimalValue

public BigDecimal decimalValue()
Returns this BigDecimal as a long.

Returns:
The BigDecimal value.

doubleValue

public double doubleValue()
Returns this DynamicObject as a double.

Returns:
The double value.

enumValue

public Enum enumValue(Class targetClass)
Returns this DynamicObject as an Enum.

Parameters:
targetClass -
Returns:
The Enum value.

equals

public boolean equals(Object obj)
Compares the specified object with this DynamicObject for equality.

Overrides:
equals in class Object
Parameters:
obj -
Returns:
true if this object is the same as the obj argument; false otherwise.

getArgument

public final <T> T getArgument(String argumentName,
                               Class<T> argumentClass)
Specified by:
getArgument in interface ArgumentMap

getElement

public DynamicObject getElement(Object key)
Returns the element associated with the key if the DynamicObject represents a map. If not it will return a Null DynamicObject.

Parameters:
key - key whose associated value is to be returned.
Returns:
the value associated with the specified key.

getElementAt

public DynamicObject getElementAt(int index)
Returns the nth element if the DynamicObject represents an array. If not it will return a Null DynamicObject.

Parameters:
index - index of element to return
Returns:
the element at the specified position.

getElementType

public Class getElementType()
Returns element type if it's a list or a map, null otherwise.

Returns:
element type.

getField

public DynamicObject getField(String fieldName)
Returns the field value corresponding to the specified field name if the DynamicObject represents a Composite. If not or if the field doesn't exist it will return a Null DynanmicObject.

Parameters:
fieldName - name of the field.
Returns:
the value of the field.

getIndexType

public final Class getIndexType()
Returns index type if it's a list or a map, null otherwise.

Returns:
index type.

getJavaClassName

public String getJavaClassName()
Returns the java class name of the object which represents this DynamicObject.

Returns:
The java class name of the object which represents this DynamicObject.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

intervalValue

public Interval intervalValue()
Returns this DynamicObject as an Interval.

Returns:
The Interval value.

intValue

public int intValue()
Returns this DynamicObject as an int

Returns:
The int value.

isBinary

public boolean isBinary()
Returns true if this DynamicObject represents a Binary.

Returns:
true if this DynamicObject represents a Binary

isBool

public boolean isBool()
Returns true if this DynamicObject represents a Bool.

Returns:
true if this DynamicObject represents a Bool.

isComposite

public boolean isComposite()
Returns true if this DynamicObject represents a Composite Object.

Returns:
true if this DynamicObject represents a Composite Object.

isDecimal

public boolean isDecimal()
Returns true if this DynamicObject represents a Decimal.

Returns:
true if this DynamicObject represents a Decimal.

isInt

public boolean isInt()
Returns true if this DynamicObject represents an Int.

Returns:
true if this DynamicObject represents an Int.

isInterval

public boolean isInterval()
Returns true if this DynamicObject represents a Interval.

Returns:
true if this DynamicObject represents a Interval.

isList

public boolean isList()
Returns true if this DynamicObject represents a List.

Returns:
true if this DynamicObject represents a List.

isAssociativeArray

public boolean isAssociativeArray()
Returns true if this DynamicObject represents a Map.

Returns:
true if this DynamicObject represents a Map.

isPredefined

public boolean isPredefined()
Returns true if this DynamicObject predefined. The predefined objects are Null, String, Int, Real, Decimal, Bool, Interval, Time and Binary.

Returns:
true if this DynamicObject is predefined.

isQuoted

public final boolean isQuoted()
Returns true if this DynamicObject is quoted.

Returns:
true if this DynamicObject is quoted.

isReal

public boolean isReal()
Returns true if this DynamicObject represents a Real.

Returns:
true if this DynamicObject represents a Real.

isString

public boolean isString()
Returns true if this DynamicObject represents a String.

Returns:
true if this DynamicObject represents a String.

isTime

public boolean isTime()
Returns true if this DynamicObject represents a Time.

Returns:
true if this DynamicObject represents a Time.

longValue

public long longValue()
Returns this DynamicObject as a long.

Returns:
The long value.

objectValue

public Object objectValue()
Returns the Object that best represents this DynamicObject.

Returns:
The Object value.

quote

public final DynamicObject.Quote quote()
Returns a new Quoted DynamicObject

Returns:
A quoted DynamicObject.

removeElementAt

public final void removeElementAt(int index)
                           throws UnsupportedOperationException
Removes the element at the specified position.

Parameters:
index - Position.
Throws:
UnsupportedOperationException

setArgument

public final void setArgument(String argumentName,
                              boolean value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              byte value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              char value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              short value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              int value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              long value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              float value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              double value)
Specified by:
setArgument in interface ArgumentMap

setArgument

public final void setArgument(String argumentName,
                              Object value)
Specified by:
setArgument in interface ArgumentMap

setElement

public void setElement(Object key,
                       Object value)
                throws UnsupportedOperationException
Associates the specified value with the specified key.

Parameters:
key - the key object.
value - the value associated to the key.
Throws:
UnsupportedOperationException

setElementAt

public final void setElementAt(int index,
                               Object value)
                        throws UnsupportedOperationException
Replaces the element located at the specified index with the specified value.

Parameters:
index - position of the element to replace.
value - replacement of the element.
Throws:
UnsupportedOperationException

setField

public final void setField(String fieldName,
                           Object value)
                    throws UnsupportedOperationException
Assigns a value to the specified field.

Parameters:
fieldName - name of the field.
value - field value.
Throws:
UnsupportedOperationException

setField

public final void setField(String fieldName,
                           boolean value)
                    throws UnsupportedOperationException
Assigns a value to the specified field.

Parameters:
fieldName - name of the field.
value - field value.
Throws:
UnsupportedOperationException

setField

public final void setField(String fieldName,
                           long value)
                    throws UnsupportedOperationException
Assigns the specified value to the field.

Parameters:
fieldName - name of the field
value - field value.
Throws:
UnsupportedOperationException

setField

public final void setField(String fieldName,
                           double value)
                    throws UnsupportedOperationException
Assigns the specified value to the field.

Parameters:
fieldName - name of the field.
value - field value.
Throws:
UnsupportedOperationException

setFieldQ

public final void setFieldQ(String fieldName,
                            Object value)
                     throws UnsupportedOperationException
Assigns a value to the specified field.

Parameters:
fieldName - name of the field.
value - field value.
Throws:
UnsupportedOperationException

setJavaClassName

public void setJavaClassName(String classname)
                      throws UnsupportedOperationException
Sets a java class name to this dynamic object. It's valid only for composite objects.

Parameters:
classname - The java classname.
Throws:
UnsupportedOperationException - If it isn't a composite object.

timeValue

public Time timeValue()
Returns this DynamicObject as a Time.

Returns:
The Time value.

asAssociativeArray

public Map<DynamicObject,DynamicObject> asAssociativeArray()
                                                    throws UnsupportedOperationException
Throws:
UnsupportedOperationException

ALBPM Process API

© Copyright 1996/2005 Fuego Inc. All Rights Reserved