jfun.yan.monitoring
Class Monitors

java.lang.Object
  extended by jfun.yan.monitoring.Monitors

public class Monitors
extends java.lang.Object

This class adds monitoring support to constructors, methods and java bean getter/setters.

Author:
Michell Lei

Constructor Summary
Monitors(ComponentMonitor mon)
          To create a new Monitors object.
 
Method Summary
 Component ctor(java.lang.Class type)
          Create a Component for the only public constructor in a class with monitoring support.
 Component ctor(java.lang.Class type, boolean suppress_security)
          Create a Component for the only public constructor in a class with monitoring support.
 Component ctor(java.lang.Class type, java.lang.Class[] param_types)
          Create a Component for the constructor specified by the given signature with monitoring support.
 Component ctor(java.lang.Class type, java.lang.Class[] param_types, boolean suppress_security)
          Create a Component for the constructor specified by the given signature with monitoring support.
 Component ctor(java.lang.reflect.Constructor ctor)
          Create a Component for a constructor with monitoring support.
static Function ctor(java.lang.reflect.Constructor ctor, CtorMonitor mon)
          Create a Function object for a Constructor with monitoring support.
static Function fun(Function f, FunctionMonitor mon)
          Decorate a Function to add monitoring support.
 Component getter(Bean bean, java.lang.String prop_name)
          Create a Component for a Java Bean property getter with monitoring support.
static Function getter(Bean bean, java.lang.String prop_name, GetterMonitor mon)
          Create a Function object for a Java Bean property getter with monitoring support.
 Component getter(Bean bean, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property getter with monitoring support.
static Function getter(Bean bean, java.lang.String prop_name, int ind, IndexedGetterMonitor mon)
          Create a Function object for a Java Bean indexed property getter with monitoring support.
 Component getter(java.lang.Class type, java.lang.Object obj, java.lang.String prop_name)
          Create a Component for a Java Bean property getter with monitoring support.
 Component getter(java.lang.Class type, java.lang.Object obj, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property getter with monitoring support.
 Component getter(java.lang.Object obj, java.lang.String prop_name)
          Create a Component for a Java Bean property getter with monitoring support.
 Component getter(java.lang.Object obj, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property getter with monitoring support.
 Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name)
          Create a Component for a method specified by name with monitoring support.
 Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name, boolean suppress_security)
          Create a Component for a method specified by name with monitoring support.
 Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types)
          Create a Component for a method specified by the given signature with monitoring support.
 Component method(java.lang.Class type, java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types, boolean suppress_security)
          Create a Component for a method specified by the given signature with monitoring support.
 Component method(java.lang.Object obj, java.lang.reflect.Method mtd)
          Create a Component for a method with monitoring support.
static Function method(java.lang.Object self, java.lang.reflect.Method mtd, MethodMonitor mon)
          Create a Function object for a Method with monitoring support.
 Component method(java.lang.Object obj, java.lang.String name)
          Create a Component for a method specified by name with monitoring support.
 Component method(java.lang.Object obj, java.lang.String name, boolean suppress_security)
          Create a Component for a method specified by name with monitoring support.
 Component method(java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types)
          Create a Component for a method specified by the given signature with monitoring support.
 Component method(java.lang.Object obj, java.lang.String name, java.lang.Class[] param_types, boolean suppress_security)
          Create a Component for a method specified by the given signature with monitoring support.
static FunctionMonitor monitor(java.lang.reflect.Constructor ctor, CtorMonitor mon)
          To adapt a CtorMonitor object to FunctionMonitor object.
static FunctionMonitor monitor(java.lang.Object obj, java.lang.reflect.Method mtd, MethodMonitor mon)
          To adapt a MethodMonitor object to FunctionMonitor object.
static FunctionMonitor monitorGetter(java.lang.Object obj, java.beans.PropertyDescriptor prop, GetterMonitor mon)
          To adapt a GetterMonitor object to FunctionMonitor object.
static FunctionMonitor monitorGetter(java.lang.Object obj, java.beans.PropertyDescriptor prop, int ind, IndexedGetterMonitor mon)
          To adapt an IndexedGetterMonitor object to FunctionMonitor object.
static FunctionMonitor monitorSetter(java.lang.Object obj, java.beans.PropertyDescriptor prop, int ind, IndexedSetterMonitor mon)
          To adapt an IndexedSetterMonitor object to FunctionMonitor object.
static FunctionMonitor monitorSetter(java.lang.Object obj, java.beans.PropertyDescriptor prop, SetterMonitor mon)
          To adapt a SetterMonitor object to FunctionMonitor object.
 Component setter(Bean bean, java.lang.String prop_name)
          Create a Component for a Java Bean property setter with monitoring support.
 Component setter(Bean bean, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property setter with monitoring support.
static Function setter(Bean bean, java.lang.String prop_name, int ind, IndexedSetterMonitor mon)
          Create a Function object for a Java Bean indexed property setter with monitoring support.
static Function setter(Bean bean, java.lang.String prop_name, SetterMonitor mon)
          Create a Function object for a Java Bean property setter with monitoring support.
 Component setter(java.lang.Class type, java.lang.Object obj, java.lang.String prop_name)
          Create a Component for a Java Bean property setter with monitoring support.
 Component setter(java.lang.Class type, java.lang.Object obj, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property setter with monitoring support.
 Component setter(java.lang.Object obj, java.lang.String prop_name)
          Create a Component for a Java Bean property setter with monitoring support.
 Component setter(java.lang.Object obj, java.lang.String prop_name, int ind)
          Create a Component for a Java Bean indexed property setter with monitoring support.
 Component static_method(java.lang.Class type, java.lang.String name)
          Create a Component for a static method specified by name with monitoring support.
 Component static_method(java.lang.Class type, java.lang.String name, boolean suppress_security)
          Create a Component for a static method specified by name with monitoring support.
 Component static_method(java.lang.Class type, java.lang.String name, java.lang.Class[] param_types)
          Create a Component for a static method specified by the given signature with monitoring support.
 Component static_method(java.lang.Class type, java.lang.String name, java.lang.Class[] param_types, boolean suppress_security)
          Create a Component for a static method specified by the given signature with monitoring support.
 Component static_method(java.lang.reflect.Method mtd)
          Create a Component for a static method with monitoring support.
static Function static_method(java.lang.reflect.Method mtd, MethodMonitor mon)
          Create a Function object for a static Method with monitoring support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Monitors

public Monitors(ComponentMonitor mon)
To create a new Monitors object.

Parameters:
mon - a ComponentMonitor object.
Method Detail

monitor

public static FunctionMonitor monitor(java.lang.reflect.Constructor ctor,
                                      CtorMonitor mon)
To adapt a CtorMonitor object to FunctionMonitor object.

Parameters:
ctor - the Constructor object.
mon - the CtorMonitor object.
Returns:
the FunctionMonitor object.

monitor

public static FunctionMonitor monitor(java.lang.Object obj,
                                      java.lang.reflect.Method mtd,
                                      MethodMonitor mon)
To adapt a MethodMonitor object to FunctionMonitor object.

Parameters:
obj - the object that the method is invoked against.
mtd - the method.
mon - the MethodMonitor object.
Returns:
the FunctionMonitor object.

monitorGetter

public static FunctionMonitor monitorGetter(java.lang.Object obj,
                                            java.beans.PropertyDescriptor prop,
                                            GetterMonitor mon)
To adapt a GetterMonitor object to FunctionMonitor object.

Parameters:
obj - the object that the getter is invoked against.
prop - the descriptor of the property.
mon - the GetterMonitor object.
Returns:
the FunctionMonitor object.

monitorGetter

public static FunctionMonitor monitorGetter(java.lang.Object obj,
                                            java.beans.PropertyDescriptor prop,
                                            int ind,
                                            IndexedGetterMonitor mon)
To adapt an IndexedGetterMonitor object to FunctionMonitor object.

Parameters:
obj - the object that the getter is invoked against.
prop - the descriptor of the property.
ind - the property index.
mon - the IndexedGetterMonitor object.
Returns:
the FunctionMonitor object.

monitorSetter

public static FunctionMonitor monitorSetter(java.lang.Object obj,
                                            java.beans.PropertyDescriptor prop,
                                            SetterMonitor mon)
To adapt a SetterMonitor object to FunctionMonitor object.

Parameters:
obj - the object that the setter is invoked against.
prop - the descriptor of the property.
mon - the SetterMonitor object.
Returns:
the FunctionMonitor object.

monitorSetter

public static FunctionMonitor monitorSetter(java.lang.Object obj,
                                            java.beans.PropertyDescriptor prop,
                                            int ind,
                                            IndexedSetterMonitor mon)
To adapt an IndexedSetterMonitor object to FunctionMonitor object.

Parameters:
obj - the object that the setter is invoked against.
prop - the descriptor of the property.
ind - the property index.
mon - the IndexedSetterMonitor object.
Returns:
the FunctionMonitor object.

fun

public static Function fun(Function f,
                           FunctionMonitor mon)
Decorate a Function to add monitoring support.

Parameters:
f - the Function object.
mon - the FunctionMonitor object.
Returns:
the new Function that supports monitoring.

ctor

public static Function ctor(java.lang.reflect.Constructor ctor,
                            CtorMonitor mon)
Create a Function object for a Constructor with monitoring support.

Parameters:
ctor - the Constructor object.
mon - the CtorMonitor object.
Returns:
the Function that supports monitoring.

method

public static Function method(java.lang.Object self,
                              java.lang.reflect.Method mtd,
                              MethodMonitor mon)
Create a Function object for a Method with monitoring support.

Parameters:
self - the object to which the method belongs.
mtd - the Method object.
mon - the MethodMonitor object.
Returns:
the Function that supports monitoring.

static_method

public static Function static_method(java.lang.reflect.Method mtd,
                                     MethodMonitor mon)
Create a Function object for a static Method with monitoring support.

Parameters:
mtd - the Method object.
mon - the MethodMonitor object.
Returns:
the Function that supports monitoring.

getter

public static Function getter(Bean bean,
                              java.lang.String prop_name,
                              GetterMonitor mon)
                       throws java.beans.IntrospectionException
Create a Function object for a Java Bean property getter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
mon - the GetterMonitor object.
Returns:
the Function that supports monitoring.
Throws:
java.beans.IntrospectionException

setter

public static Function setter(Bean bean,
                              java.lang.String prop_name,
                              SetterMonitor mon)
                       throws java.beans.IntrospectionException
Create a Function object for a Java Bean property setter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
mon - the SetterMonitor object.
Returns:
the Function that supports monitoring.
Throws:
java.beans.IntrospectionException

getter

public static Function getter(Bean bean,
                              java.lang.String prop_name,
                              int ind,
                              IndexedGetterMonitor mon)
                       throws java.beans.IntrospectionException
Create a Function object for a Java Bean indexed property getter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
ind - the property index.
mon - the IndexedGetterMonitor object.
Returns:
the Function that supports monitoring.
Throws:
java.beans.IntrospectionException

setter

public static Function setter(Bean bean,
                              java.lang.String prop_name,
                              int ind,
                              IndexedSetterMonitor mon)
                       throws java.beans.IntrospectionException
Create a Function object for a Java Bean indexed property setter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
ind - the property index.
mon - the IndexedSetterMonitor object.
Returns:
the Function that supports monitoring.
Throws:
java.beans.IntrospectionException

ctor

public Component ctor(java.lang.reflect.Constructor ctor)
Create a Component for a constructor with monitoring support.

Parameters:
ctor - the Constructor object.
Returns:
the Component object with monitoring support.

ctor

public Component ctor(java.lang.Class type,
                      java.lang.Class[] param_types)
               throws java.lang.IllegalArgumentException
Create a Component for the constructor specified by the given signature with monitoring support.

Parameters:
type - the type for the constructor.
param_types - the parameter types of the constructor.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no public constructor.

ctor

public Component ctor(java.lang.Class type,
                      java.lang.Class[] param_types,
                      boolean suppress_security)
               throws java.lang.IllegalArgumentException
Create a Component for the constructor specified by the given signature with monitoring support.

Parameters:
type - the type for the constructor.
param_types - the parameter types of the constructor.
suppress_security - whether non-public constructors are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no constructor is found.

ctor

public Component ctor(java.lang.Class type)
               throws java.lang.IllegalArgumentException
Create a Component for the only public constructor in a class with monitoring support.

Parameters:
type - the type for the constructor.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no public constructor is found or more than one are found.

ctor

public Component ctor(java.lang.Class type,
                      boolean suppress_security)
               throws java.lang.IllegalArgumentException
Create a Component for the only public constructor in a class with monitoring support.

Parameters:
type - the type for the constructor.
suppress_security - whether non-public constructors are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no constructor is found or more than one are found.

method

public Component method(java.lang.Object obj,
                        java.lang.reflect.Method mtd)
Create a Component for a method with monitoring support.

Parameters:
obj - the 'this' object to invoke the method against.
mtd - the method object.
Returns:
the Component object with monitoring support.

method

public Component method(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String name,
                        java.lang.Class[] param_types)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by the given signature with monitoring support.

Parameters:
type - the type to search method.
obj - the 'this' object to invoke the method against.
name - the method name.
param_types - the parameter types of the method.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the method is not found.

method

public Component method(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String name,
                        java.lang.Class[] param_types,
                        boolean suppress_security)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by the given signature with monitoring support.

Parameters:
type - the type to search method.
obj - the 'this' object to invoke the method against.
name - the method name.
param_types - the parameter types of the method.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the method is not found.

method

public Component method(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String name)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by name with monitoring support.

Parameters:
type - the type to search method.
obj - the 'this' object to invoke the method against.
name - the method name.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no public method with this name is found or more than one are found.

method

public Component method(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String name,
                        boolean suppress_security)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by name with monitoring support.

Parameters:
type - the type to search method.
obj - the 'this' object to invoke the method against.
name - the method name.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no method with this name is found or more than one are found.

static_method

public Component static_method(java.lang.reflect.Method mtd)
                        throws java.lang.IllegalArgumentException
Create a Component for a static method with monitoring support.

Parameters:
mtd - the method object.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the method is not static.

static_method

public Component static_method(java.lang.Class type,
                               java.lang.String name,
                               java.lang.Class[] param_types)
                        throws java.lang.IllegalArgumentException
Create a Component for a static method specified by the given signature with monitoring support.

Parameters:
type - the type to search method.
name - the method name.
param_types - the parameter types of the method.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the static method is not found.

static_method

public Component static_method(java.lang.Class type,
                               java.lang.String name,
                               java.lang.Class[] param_types,
                               boolean suppress_security)
                        throws java.lang.IllegalArgumentException
Create a Component for a static method specified by the given signature with monitoring support.

Parameters:
type - the type to search method.
name - the method name.
param_types - the parameter types of the method.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the static method is not found.

static_method

public Component static_method(java.lang.Class type,
                               java.lang.String name)
                        throws java.lang.IllegalArgumentException
Create a Component for a static method specified by name with monitoring support.

Parameters:
type - the type to search method.
name - the method name.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no public static method with this name is found or more than one are found.

static_method

public Component static_method(java.lang.Class type,
                               java.lang.String name,
                               boolean suppress_security)
                        throws java.lang.IllegalArgumentException
Create a Component for a static method specified by name with monitoring support.

Parameters:
type - the type to search method.
name - the method name.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no static method with this name is found or more than one are found.

method

public Component method(java.lang.Object obj,
                        java.lang.String name,
                        java.lang.Class[] param_types)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by the given signature with monitoring support.

Parameters:
obj - the 'this' object to invoke the method against.
name - the method name.
param_types - the parameter types of the method.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the method is not found.

method

public Component method(java.lang.Object obj,
                        java.lang.String name,
                        java.lang.Class[] param_types,
                        boolean suppress_security)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by the given signature with monitoring support.

Parameters:
obj - the 'this' object to invoke the method against.
name - the method name.
param_types - the parameter types of the method.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if the method is not found.

method

public Component method(java.lang.Object obj,
                        java.lang.String name)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by name with monitoring support.

Parameters:
obj - the 'this' object to invoke the method against.
name - the method name.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no public method with this name is found or more than one are found.

method

public Component method(java.lang.Object obj,
                        java.lang.String name,
                        boolean suppress_security)
                 throws java.lang.IllegalArgumentException
Create a Component for a method specified by name with monitoring support.

Parameters:
obj - the 'this' object to invoke the method against.
name - the method name.
suppress_security - whether non-public methods are searched at all.
Returns:
the Component object with monitoring support.
Throws:
java.lang.IllegalArgumentException - if no method with this name is found or more than one are found.

getter

public Component getter(Bean bean,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property getter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(Bean bean,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property setter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

getter

public Component getter(Bean bean,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property getter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(Bean bean,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property setter with monitoring support.

Parameters:
bean - the bean.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

getter

public Component getter(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property getter with monitoring support.

Parameters:
type - the type to search the property.
obj - the object to invoke the getter against.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property setter with monitoring support.

Parameters:
type - the type to search the property.
obj - the object to invoke the setter against.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

getter

public Component getter(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property getter with monitoring support.

Parameters:
type - the type to search the property.
obj - the object to invoke the getter against.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(java.lang.Class type,
                        java.lang.Object obj,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property setter with monitoring support.

Parameters:
type - the type to search the property.
obj - the object to invoke the setter against.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

getter

public Component getter(java.lang.Object obj,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property getter with monitoring support.

Parameters:
obj - the object to invoke the getter against.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(java.lang.Object obj,
                        java.lang.String prop_name)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean property setter with monitoring support.

Parameters:
obj - the object to invoke the setter against.
prop_name - the property name.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

getter

public Component getter(java.lang.Object obj,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property getter with monitoring support.

Parameters:
obj - the object to invoke the getter against.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.

setter

public Component setter(java.lang.Object obj,
                        java.lang.String prop_name,
                        int ind)
                 throws java.beans.IntrospectionException
Create a Component for a Java Bean indexed property setter with monitoring support.

Parameters:
obj - the object to invoke the setter against.
prop_name - the property name.
ind - the property index.
Returns:
the Component object with monitoring support.
Throws:
java.beans.IntrospectionException - when introspection error happends.