fr.umlv.tatoo.runtime.tools
Class Debug

java.lang.Object
  extended by fr.umlv.tatoo.runtime.tools.Debug

public class Debug
extends Object

A bunch of static methods that help to debugs Tatoo evaluators.

Author:
Remi Forax

Constructor Summary
Debug()
           
 
Method Summary
static
<T> T
createConverterProxy(Class<T> type, StringConverter converter)
          This method provides a proxy object implementing an interface.
static
<T> T
createTraceProxy(Class<T> type)
          Creates a proxy that prints out all methods, of the interface, called.
static
<T> T
createTraceProxy(Class<T> type, T impl)
          Creates a proxy that prints outs all methods, of the interface, called and then delegates the method call to impl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Debug

public Debug()
Method Detail

createConverterProxy

public static <T> T createConverterProxy(Class<T> type,
                                         StringConverter converter)
This method provides a proxy object implementing an interface. For each method of the interface, the proxy automagically converts the object pass as argument of the method to its value using its textual representation of the object.
    interface I {
      int toInteger(String s);
      double toDouble(String s);
    }
    ...
    I proxy=Debug.createConverterProxy(I.class,new DefaultStringConverter());
    proxy.toInteger("3"); // return 3
    proxy.toDouble("5.0"); // return 5.0
  

Type Parameters:
T - the type of the interface.
Parameters:
type - the class of the interface.
converter - the converter used to convert the textual representation to a value.
Returns:
an object that implements the given interface.
See Also:
Object.toString()

createTraceProxy

public static <T> T createTraceProxy(Class<T> type)
Creates a proxy that prints out all methods, of the interface, called. The returned value of each method is the default value of its return type.

Type Parameters:
T - the type of the interface
Parameters:
type - the class of the interface.
Returns:
a proxy that trace all method calls.

createTraceProxy

public static <T> T createTraceProxy(Class<T> type,
                                     T impl)
Creates a proxy that prints outs all methods, of the interface, called and then delegates the method call to impl.

Type Parameters:
T - the type of the interface
Parameters:
type - the class of the interface.
impl - the implementation used to delegate.
Returns:
a proxy that trace all method calls.