cookxml.core
Class FunctionHandler

java.lang.Object
  extended bycookxml.core.FunctionHandler
All Implemented Interfaces:
Handler

public class FunctionHandler
extends Object
implements Handler

Ths handler deals with functions.

Since:
CookXml 1.0

Method Summary
static Handler getHandler(Object obj, String funcName, Class valueClass)
          This function assumes that each function name is only associated with a single data type.
 Method getMethod()
           
 boolean invoke(String ns, Object obj, Object value, DecodeEngine decodeEngine)
          this function is used to assign the value to the object either through a function setter or directly through variable assignment.
 String toString()
          for debugging purpose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

invoke

public boolean invoke(String ns,
                      Object obj,
                      Object value,
                      DecodeEngine decodeEngine)
               throws HandlerException
Description copied from interface: Handler
this function is used to assign the value to the object either through a function setter or directly through variable assignment.

Specified by:
invoke in interface Handler
Parameters:
ns - the namespace of the element being used.
obj - the object where the function or the variable is located in.
value - the actual value to be set.
decodeEngine -
Throws:
HandlerException

getMethod

public Method getMethod()

toString

public String toString()
for debugging purpose.

Returns:
the method involved

getHandler

public static Handler getHandler(Object obj,
                                 String funcName,
                                 Class valueClass)
This function assumes that each function name is only associated with a single data type. Although it may be possible to switch types, but we won't be able to utilize cache in that case, making it rather slow to find function each and every time.

Parameters:
obj - the object we are dealing with. we are actually only interested in its class type
funcName - the function to be located in the class
valueClass - the class type of the value, can be null to skip check.
Returns:
the handler which can be used to deal with the element