com.mycila.testing.core.introspect
Class Introspector

java.lang.Object
  extended by com.mycila.testing.core.introspect.Introspector

public final class Introspector
extends Object

Handles a test instance

Author:
Mathieu Carbou (mathieu.carbou@gmail.com)

Constructor Summary
Introspector(Object instance)
           
 
Method Summary
 Object get(Field field)
          Get a field's value
 boolean hasAnnotation(Class<? extends Annotation> annot)
           
 Object instance()
           
 Object invoke(Method method, Object... args)
          Invoke a method on this test instance
 List<Field> selectFields(Filter<Field> filter)
          Select some fields.
 List<Method> selectMethods(Filter<Method> filter)
          Select some methods.
 void set(Field field, Object value)
          Set a field value
 Class<?> testClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Introspector

public Introspector(Object instance)
Method Detail

instance

public Object instance()
Returns:
The test instance

testClass

public Class<?> testClass()
Returns:
The test instance's class

selectFields

public List<Field> selectFields(Filter<Field> filter)
Select some fields. Use the Filters class to create and compose filters

Parameters:
filter - Filter to use for selection
Returns:
A list containing the selected objects

selectMethods

public List<Method> selectMethods(Filter<Method> filter)
Select some methods. Use the Filters class to create and compose filters

Parameters:
filter - Filter to use for selection
Returns:
A list containing the selected objects

invoke

public Object invoke(Method method,
                     Object... args)
Invoke a method on this test instance

Parameters:
method - Method to be invoked
args - Method argument
Returns:
The result of the invokation

get

public Object get(Field field)
Get a field's value

Parameters:
field - The field
Returns:
The field value

set

public void set(Field field,
                Object value)
Set a field value

Parameters:
field - The field
value - The new field value

hasAnnotation

public boolean hasAnnotation(Class<? extends Annotation> annot)


Copyright © 2008-2011 Mycila. All Rights Reserved.