org.ispheres.shared.transforms
Class TransformInterface

java.lang.Object
  extended by org.ispheres.shared.transforms.TransformInterface

public final class TransformInterface
extends java.lang.Object

This class describes the interface for a particular transform. It contains the list of the parameters that are required by the transform and also holds the name of the transform and the parameters that get parsed to the transform when it's send back to the client. Parameters can only be added when the object is on the server side and values for parameters can only be set on the client side.

Author:
Jonathan Mezach

Nested Class Summary
 class TransformInterface.Parameter
          Inner class for storing the information for a Parameter.
 
Constructor Summary
TransformInterface(java.lang.String theTransformClassName)
          Constructs a new interface for a transform using the specified transform name and classname and an empty list of parameters with no values.
 
Method Summary
 void addParameter(java.lang.String theParameterName, java.lang.Class theParameterType)
          Adds a parameter to the list of parameters required by the transform.
 void flipSide()
          Flips the side from server to client.
 java.lang.String getParameterName(int index)
          Returns the name of the parameter at the specified index.
 TransformInterface.Parameter[] getParameters()
          Returns the list of parameters as an array of Parameter objects.
 java.lang.Class getParameterType(int index)
          Returns the type of the parameter at the specified index.
 java.lang.Object getParameterValue(int index)
          Returns the value of the parameter at the specified index.
 java.lang.String getTransformClassName()
          Returns the full class name of the class that will perform transform as perscribed by this TransformInterface.
 java.lang.String getTransformName()
          Returns the name of the transform that can be performed on a particular object.
 void setParameterValue(int index, java.lang.Object value)
          Sets the value of the parameter at the specified index to the specified value.
 java.lang.String toString()
          Returns a String representation of this TransformInterface object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransformInterface

public TransformInterface(java.lang.String theTransformClassName)
Constructs a new interface for a transform using the specified transform name and classname and an empty list of parameters with no values.

Parameters:
theTransformClassName - The name of the class that will perform transforms describes by this interface.
Method Detail

getTransformName

public java.lang.String getTransformName()
Returns the name of the transform that can be performed on a particular object.

Returns:
The name of the transform that can be performed.

getTransformClassName

public java.lang.String getTransformClassName()
Returns the full class name of the class that will perform transform as perscribed by this TransformInterface.

Returns:
A String containing a fully qualified Java classname.

addParameter

public void addParameter(java.lang.String theParameterName,
                         java.lang.Class theParameterType)
Adds a parameter to the list of parameters required by the transform. It might throw an IllegalStateException when the instance is being handled by the client and not on the server. Parameters should be added in the order in which they should appear in the call to the transform.

Parameters:
theParameterName - The name of the parameter that is being supplied to the transform.
theParameterType - A Class object representing the type of value for the parameter that is being added.

getParameters

public TransformInterface.Parameter[] getParameters()
Returns the list of parameters as an array of Parameter objects.

Returns:
An array of Parameters containing the information for each parameter required by the transform.

getParameterName

public java.lang.String getParameterName(int index)
Returns the name of the parameter at the specified index. It might throw an IndexOutOfBoundsException when the specified index does not exist.

Parameters:
index - The index number of the parameter to get the name for.
Returns:
A String containing the name of the parameter at the specified index.

getParameterType

public java.lang.Class getParameterType(int index)
Returns the type of the parameter at the specified index. It throws an IndexOutOfBoundsException when the specified index does not exist.

Parameters:
index - The index number of the parameter to get the value for.
Returns:
A Class object representing the runtime type of the parameter at the specified index.

getParameterValue

public java.lang.Object getParameterValue(int index)
Returns the value of the parameter at the specified index. The type of the return value is the result of calling getParameterType(index). It throws an Index OutOfBoundsException when the specified index does not exist.

Parameters:
index - The index number of the parameter to get the value for.
Returns:
An Object containing the value of the parameter.

setParameterValue

public void setParameterValue(int index,
                              java.lang.Object value)
Sets the value of the parameter at the specified index to the specified value. It can throw an IllegalStateException when the TransformInterface object is on the server side. It can also throw an IllegalArgumentException when supplied value is not of the expected type.

Parameters:
index - The index number of the parameter to set the value for.
value - An Object containing the value to set for the specified parameter.

flipSide

public void flipSide()
Flips the side from server to client. This function should only be called by the encoder when it is deserialised on the client side. This will make sure that no parameters can be added and values can be set. It will throw an IllegalStateException when it is already in client side mode.


toString

public java.lang.String toString()
Returns a String representation of this TransformInterface object. This is mainly used for debugging purposes.

Overrides:
toString in class java.lang.Object
Returns:
A String containing the textual representation of the object.


Copyright © 2004-2005 The Archaeological Computing Laboratory, University of Sydney. All Rights Reserved.