FileDocCategorySizeDatePackage
MethodLogger.javaAPI DocAndroid 1.5 API2584Wed May 06 22:41:06 BST 2009tests.api.org.xml.sax.support

MethodLogger

public class MethodLogger extends Object
A simple helper class that logs method calls by storing method names and parameter lists. Used as a foundation for various simple SAX handlers.

Fields Summary
private List
methods
The names of the invoked methods, in order.
private List
argLists
The parameter lists of the invoked methods, in order.
Constructors Summary
Methods Summary
public voidadd(java.lang.String method, java.lang.Object args)
Adds a method call with a variable list of arguments.


                   
           
        Object[] argsCopy = new Object[args.length];
        System.arraycopy(args, 0, argsCopy, 0, args.length);
        
        methods.add(method);
        argLists.add(argsCopy);
    
public voidclear()
Clears the log.

        methods.clear();
        argLists.clear();
    
public java.lang.Object[]getArgs(int index)
Returns the argument array stored at the given index. May be empty, but not null.

        return argLists.get(index);
    
public java.lang.Object[]getArgs()
Returns the argument array of the last method that was invoked. Returns null if no method has been invoked so far.

        return (size() == 0 ? null : getArgs(size() - 1));
    
public java.lang.StringgetMethod(int index)
Returns the method name stored at the given index.

        return methods.get(index);
    
public java.lang.StringgetMethod()
Returns the name of the last method that was invoked. Returns null if no method calls have been logged so far.

        return (size() == 0 ? null : getMethod(size() - 1));
    
public intsize()
Returns the number of method invoked so far.

        return methods.size();