cookxml.core
Class VariableHandler

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

public class VariableHandler
extends Object
implements Handler

Ths handler deals with variables.

Since:
CookXml 1.0

Method Summary
static Handler getHandler(Object obj, String fieldName, Class valueClass)
          This function assumes that each function name is only associated with a single data type.
 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

toString

public String toString()
for debugging purpose.

Returns:
the method involved

getHandler

public static Handler getHandler(Object obj,
                                 String fieldName,
                                 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.
fieldName - the field 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.