org.mockcentral.server
Class SignaturePartBuilder

java.lang.Object
  extended by org.mockcentral.server.SignaturePartBuilder

public class SignaturePartBuilder
extends java.lang.Object

A class used to build an Object (or primitive value) to comprise a single Mock Object method parameter or expected result value, or a simple Object to be bound into the JNDI Context for the current Fixture. The extractObject method accepts a SignaturepartBean instance whose valueType field is used to determine the strategy for building the Object. This field value must correspond to one of the ValueType enum values. See the ValueType javadoc for details about the various strategies.

Author:
David Hutchinson
See Also:
Fixture, SignaturePartBean, ValueType

Method Summary
static java.lang.Object extractObject(SignaturePartBean bean, boolean isCollectionEntry)
          Returns an Object constructed using the data from the supplied SignaturePartBean instance.
static void setClassLoader(java.lang.ClassLoader classLoader)
          Sets the ClassLoader.
static void setCurrentFixture(Fixture fixture)
          Assigns the Fixture instance which will be used to get any proxy Objects needed for the signature part value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setClassLoader

public static void setClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader.

Parameters:
classLoader - the ClassLoader to set.

setCurrentFixture

public static void setCurrentFixture(Fixture fixture)
Assigns the Fixture instance which will be used to get any proxy Objects needed for the signature part value.

Parameters:
fixture - the Fixture instance.

extractObject

public static java.lang.Object extractObject(SignaturePartBean bean,
                                             boolean isCollectionEntry)
                                      throws UnknownProxyException,
                                             MockCentralServerException
Returns an Object constructed using the data from the supplied SignaturePartBean instance.

Parameters:
bean - the SignaturePartBean from which to create the return Object.
isCollectionEntry - whether the bean represents an entry in a Collection or Array defined by an enclosing instance.
Returns:
an Object constructed using the data from the supplied SignaturePartBean instance.
Throws:
UnknownProxyException - if the Object type is a reference and the Proxy referenced could not be obtained.
MockCentralServerException - if the Object could not be constructed for any other reason.