org.decisiondeck.jmcda.xws.transformer
Class TransformersWithInputCheck

java.lang.Object
  extended by org.decisiondeck.jmcda.xws.transformer.TransformersWithInputCheck

public class TransformersWithInputCheck
extends Object

Contains a set of functions, called transformers, accessible by return type. One transformer maximum for a given return type.


Constructor Summary
TransformersWithInputCheck()
           
TransformersWithInputCheck(Set<FunctionWithInputCheck<?,?>> functions)
          Creates a transformers object holding the given functions.
 
Method Summary
 void add(FunctionWithInputCheck<?,?> function)
          Adds the given function to this set of functions.
 void addAll(Set<FunctionWithInputCheck<?,?>> functions)
          Adds all the given functions to this set of functions.
 boolean contains(Type returnType)
          Tests whether the given return type has an associated function.
static Method getApplyMethod(Class<? extends FunctionWithInputCheck<?,?>> function)
          Retrieves the apply method of the given class implementing a function.
 Type getRequired(Type returnType)
          Retrieves the type of the required parameter to use the function associated to the given return type.
 FunctionWithInputCheck<?,?> getTransformer(Type returnType)
          Retrieves the transformer function associated with the given return type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformersWithInputCheck

public TransformersWithInputCheck(Set<FunctionWithInputCheck<?,?>> functions)
Creates a transformers object holding the given functions. No reference is kept to the given set. The functions must each have a different return type.

Parameters:
functions - not null.

TransformersWithInputCheck

public TransformersWithInputCheck()
Method Detail

addAll

public void addAll(Set<FunctionWithInputCheck<?,?>> functions)
Adds all the given functions to this set of functions. The functions must each have a return type that is not already associated with a function.

Parameters:
functions - not null.

add

public void add(FunctionWithInputCheck<?,?> function)
Adds the given function to this set of functions. The function must have a return type that is not already associated with a function.

Parameters:
function - not null.

contains

public boolean contains(Type returnType)
Tests whether the given return type has an associated function.

Parameters:
returnType - not null.
Returns:
true iff a function in this object has the given return type.

getApplyMethod

public static Method getApplyMethod(Class<? extends FunctionWithInputCheck<?,?>> function)
Retrieves the apply method of the given class implementing a function. Only one apply method must be declared, or one with object types and one with non-object types, the later one being chosen in this case. The returned method is guaranteed to have only one parameter.

Parameters:
function - not null.
Returns:
not null.

getRequired

public Type getRequired(Type returnType)
Retrieves the type of the required parameter to use the function associated to the given return type. The return type must have an associated function.

Parameters:
returnType - not null, must be contained in this object.
Returns:
not null.
See Also:
contains(Type)

getTransformer

public FunctionWithInputCheck<?,?> getTransformer(Type returnType)
Retrieves the transformer function associated with the given return type. The return type must be contained in this object.

Parameters:
returnType - not null, in this object.
Returns:
not null.


Copyright © 2011. All Rights Reserved.