org.sourceforge.espro.model
Class MethodProvider

java.lang.Object
  extended by org.sourceforge.espro.model.MethodProvider

public class MethodProvider
extends java.lang.Object

The MethodProvider provides the elicitation methods. This will find any method from the probelicitation package which can be used with espro.

Author:
(c) 2007 Martin Kaffanke

Field Summary
protected  java.util.ArrayList<java.lang.String> methods
          The list of the available methods.
 
Method Summary
 ElicitationMethod getDefault()
          Returns a default Method.
 java.lang.reflect.Method getGetter(java.lang.reflect.Field f, ElicitationMethod method)
          Returns the getter for the field.
static MethodProvider getInstance()
          This is a singleton class, so geht the instance here.
 ElicitationMethod getMethod(ElicitationMethod elicitationMethod)
          Returns a new ElicitationMethod created using the parameters of the given elicitation method.
 ElicitationMethod getMethod(java.lang.String method)
          Returns the method by a given string.
static java.lang.String getMethodPrefix()
          Returns the methodPrefix.
 java.util.ArrayList<java.lang.String> getMethods()
          Returns the list of names of the known methods.
 java.lang.reflect.Method getSetter(java.lang.reflect.Field f, ElicitationMethod method)
          Returns a setter for the given field.
static void setMethodPrefix(java.lang.String methodPrefix)
          Sets the methodPrefix
protected  boolean validateMethod(java.lang.String name)
          Validates the method if it is available and correct programmed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methods

protected java.util.ArrayList<java.lang.String> methods
The list of the available methods.

Method Detail

getInstance

public static MethodProvider getInstance()
This is a singleton class, so geht the instance here.

Returns:
The instance of MethodProvider.

getMethodPrefix

public static java.lang.String getMethodPrefix()
Returns the methodPrefix.

Returns:
The methodPrefix.

setMethodPrefix

public static void setMethodPrefix(java.lang.String methodPrefix)
Sets the methodPrefix

Parameters:
methodPrefix - The methodPrefix to set.

getDefault

public ElicitationMethod getDefault()
Returns a default Method. Use this if you need a Method but you don't know which one need.

Returns:
The method.

getGetter

public java.lang.reflect.Method getGetter(java.lang.reflect.Field f,
                                          ElicitationMethod method)
Returns the getter for the field.

Parameters:
f - The field.
method - The elicitationMethod which contains the getter.
Returns:
The getter method.

getMethod

public ElicitationMethod getMethod(java.lang.String method)
Returns the method by a given string.

Parameters:
method - The method's name.
Returns:
The method.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

getMethods

public java.util.ArrayList<java.lang.String> getMethods()
Returns the list of names of the known methods.

Returns:
The list of methods.

getSetter

public java.lang.reflect.Method getSetter(java.lang.reflect.Field f,
                                          ElicitationMethod method)
Returns a setter for the given field.

Parameters:
f - The field.
method - The ElicitationMethod which containts the setter.
Returns:
The setter method.

validateMethod

protected boolean validateMethod(java.lang.String name)
Validates the method if it is available and correct programmed.

Parameters:
name - The Name of the method.
Returns:
boolean, if the method is valid.

getMethod

public ElicitationMethod getMethod(ElicitationMethod elicitationMethod)
Returns a new ElicitationMethod created using the parameters of the given elicitation method.

Parameters:
elicitationMethod - The Method fetching the params from.
Returns:
The new ElicitationMethod.