org.mockcentral.server
Enum ValueType

java.lang.Object
  extended by java.lang.Enum<ValueType>
      extended by org.mockcentral.server.ValueType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ValueType>

public enum ValueType
extends java.lang.Enum<ValueType>

An enum declaring the available value types for an Object (or primitive value) created using the SignaturePartBuilder.extractObject method.

Author:
David Hutchinson
See Also:
SignaturePartBuilder, SignaturePartBean

Enum Constant Summary
ARRAY
          The result will be a new Array.
COLLECTION
          The result will be a new instance of a java.util.Collection class.
CONSTANT
          The result will be an constant value.
ENUM
          The result will be an Enum constant value.
INSTANCE
          The result will be a newly created class instance.
MOCK_OBJECT
          The result will be a Mock Object definied within the current Fixture.
NULL
          The result will be null.
OBJECT
          The result will be a wrapped primitive(Integer, Long, Short, Float or Double) or String.
PRIMITIVE
          The result will be a primitive (boolean or int).
THROWABLE
          The result will be a newly created Throwable class instance.
VARIABLE
          The result will be a runtime variable supplied to the server.
 
Method Summary
 java.lang.String getLabel()
          Returns the label for this Enum value.
static ValueType getValueType(java.lang.String label)
          Returns the ValueType corresponding to the supplied label.
static ValueType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ValueType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PRIMITIVE

public static final ValueType PRIMITIVE
The result will be a primitive (boolean or int). Other primitives are not supported (they are not supported in the MockObjects framework), and this type is limited to the method's expected result (the MockObjects framework's FullConstraintMatcher class, which is used to set the parameters for the mock object method expectations, cannot accept primitives). The result will be constructed from the corresponding "valueClassName" and "value" field values.

Note that since java 1.5 it is not necessary to use this value type as unboxing of OBJECT value types will be handled automatically.


OBJECT

public static final ValueType OBJECT
The result will be a wrapped primitive(Integer, Long, Short, Float or Double) or String. The Object will be constructed from the corresponding "valueClassName" and "value" field values.


MOCK_OBJECT

public static final ValueType MOCK_OBJECT
The result will be a Mock Object definied within the current Fixture. The "value" field value is used to look up the specific entry from the map contained in the current Fixture .


INSTANCE

public static final ValueType INSTANCE
The result will be a newly created class instance. Constructor arguments are supplied using the SignaturePartBean.addConstructorArg method. The Object will be constructed from the corresponding "valueClassName" and "contructorArgs" field values.


VARIABLE

public static final ValueType VARIABLE
The result will be a runtime variable supplied to the server. The "value" field value is used to look up the specific variable in the HashTable supplied to the MockCentralServer.


THROWABLE

public static final ValueType THROWABLE
The result will be a newly created Throwable class instance. Constructor arguments are supplied using the SignaturePartBean.addConstructorArg method. The Object will be constructed from the corresponding "valueClassName" and "contructorArgs" field values.


COLLECTION

public static final ValueType COLLECTION
The result will be a new instance of a java.util.Collection class. Entries for the collection are supplied using the SignaturePartBean.addCollectionEntry method. The Object will be constructed from the corresponding "valueClassName" and "collectionEntries" field values.


ARRAY

public static final ValueType ARRAY
The result will be a new Array. Elements for the Array are supplied using the SignaturePartBean.addCollectionEntry method. The Object will be constructed from the corresponding "valueClassName" and "collectionEntries" field values.


ENUM

public static final ValueType ENUM
The result will be an Enum constant value. This result will be obtained using the "valueClassName" and "value" field values, which correspond to the Enum class and constant value name.


CONSTANT

public static final ValueType CONSTANT
The result will be an constant value. This value will be obtained using the "valueClassName" and "value" field values, which correspond to the declaring Class and constant field name.


NULL

public static final ValueType NULL
The result will be null.

Method Detail

values

public static ValueType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ValueType c : ValueType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ValueType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getLabel

public java.lang.String getLabel()
Returns the label for this Enum value.

Returns:
the label for this Enum value.

getValueType

public static ValueType getValueType(java.lang.String label)
                              throws MockCentralServerException
Returns the ValueType corresponding to the supplied label.

Parameters:
label - the label for the ValueType
Returns:
the ValueType corresponding to the supplied label. throws MockCentralServerException if there is no ValueType with the supplied label.
Throws:
MockCentralServerException