org.jboss.joinpoint.plugins
Class Config

java.lang.Object
  extended by org.jboss.joinpoint.plugins.Config

public class Config
extends Object

Config utilities.

Version:
$Revision: 81547 $
Author:
Adrian Brock, Ales Justin

Field Summary
protected static org.jboss.logging.Logger log
          The log
 
Constructor Summary
Config()
           
 
Method Summary
static void configure(Object object, JoinpointFactory jpf, String name, Object value)
          Configure a field
static boolean equals(String[] typeNames, TypeInfo[] typeInfos)
          Test whether type names are equal to type infos
static ConstructorInfo findConstructorInfo(ClassInfo classInfo, String[] paramTypes)
          Find constructor info
static FieldInfo findFieldInfo(ClassInfo classInfo, String name)
          Find field info
static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes)
          Find method info
static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean strict)
          Find method info
static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean isStatic, boolean isPublic)
          Find method info
static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean isStatic, boolean isPublic, boolean strict)
          Find method info
static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf)
          Get a constructor Joinpoint
static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf, String[] paramTypes, Object[] params)
          Get a constructor Joinpoint
static FieldGetJoinpoint getFieldGetJoinpoint(Object object, JoinpointFactory jpf, String name)
          Get a field get joinpoint
static FieldSetJoinpoint getFieldSetJoinpoint(Object object, JoinpointFactory jpf, String name, Object value)
          Get a field set joinpoint
static MethodJoinpoint getMethodJoinpoint(Object object, JoinpointFactory jpf, String name, String[] paramTypes, Object[] params)
          Get a method joinpoint
static MethodJoinpoint getStaticMethodJoinpoint(JoinpointFactory jpf, String name, String[] paramTypes, Object[] params)
          Get a static method joinpoint
static Object instantiate(JoinpointFactory jpf, String[] paramTypes, Object[] params)
          Instantiate an object
static Object invoke(Object object, JoinpointFactory jpf, String name, String[] paramTypes, Object[] params)
          Invoke a method
protected static boolean simpleCheck(String[] typeNames, TypeInfo[] typeInfos)
          A simple null and length check.
static void unconfigure(Object object, JoinpointFactory jpf, String name)
          Unconfigure a field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log
The log

Constructor Detail

Config

public Config()
Method Detail

instantiate

public static Object instantiate(JoinpointFactory jpf,
                                 String[] paramTypes,
                                 Object[] params)
                          throws Throwable
Instantiate an object

Parameters:
jpf - the join point factory
paramTypes - the parameter types
params - the parameters
Returns:
the instantiated object
Throws:
Throwable - for any error

configure

public static void configure(Object object,
                             JoinpointFactory jpf,
                             String name,
                             Object value)
                      throws Throwable
Configure a field

Parameters:
object - the object to configure
jpf - the join point factory
name - the name of the field
value - the value
Throws:
Throwable - for any error

unconfigure

public static void unconfigure(Object object,
                               JoinpointFactory jpf,
                               String name)
                        throws Throwable
Unconfigure a field

Parameters:
object - the object to unconfigure
jpf - the join point factory
name - the name of the field
Throws:
Throwable - for any error

invoke

public static Object invoke(Object object,
                            JoinpointFactory jpf,
                            String name,
                            String[] paramTypes,
                            Object[] params)
                     throws Throwable
Invoke a method

Parameters:
object - the object to invoke
jpf - the join point factory
name - the name of the method
paramTypes - the parameter types
params - the parameters
Returns:
the result of the invocation
Throws:
Throwable - for any error

getConstructorJoinpoint

public static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf)
                                                    throws Throwable
Get a constructor Joinpoint

Parameters:
jpf - the join point factory
Returns:
the Joinpoint
Throws:
Throwable - for any error

getConstructorJoinpoint

public static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf,
                                                           String[] paramTypes,
                                                           Object[] params)
                                                    throws Throwable
Get a constructor Joinpoint

Parameters:
jpf - the join point factory
paramTypes - the parameter types
params - the parameters
Returns:
the Joinpoint
Throws:
Throwable - for any error

getFieldGetJoinpoint

public static FieldGetJoinpoint getFieldGetJoinpoint(Object object,
                                                     JoinpointFactory jpf,
                                                     String name)
                                              throws Throwable
Get a field get joinpoint

Parameters:
object - the object to configure
jpf - the join point factory
name - the name of the field
Returns:
the Joinpoint
Throws:
Throwable - for any error

getFieldSetJoinpoint

public static FieldSetJoinpoint getFieldSetJoinpoint(Object object,
                                                     JoinpointFactory jpf,
                                                     String name,
                                                     Object value)
                                              throws Throwable
Get a field set joinpoint

Parameters:
object - the object to configure
jpf - the join point factory
name - the name of the field
value - the value
Returns:
the Joinpoint
Throws:
Throwable - for any error

getMethodJoinpoint

public static MethodJoinpoint getMethodJoinpoint(Object object,
                                                 JoinpointFactory jpf,
                                                 String name,
                                                 String[] paramTypes,
                                                 Object[] params)
                                          throws Throwable
Get a method joinpoint

Parameters:
object - the object to invoke
jpf - the join point factory
name - the name of the method
paramTypes - the parameter types
params - the parameters
Returns:
the join point
Throws:
Throwable - for any error

getStaticMethodJoinpoint

public static MethodJoinpoint getStaticMethodJoinpoint(JoinpointFactory jpf,
                                                       String name,
                                                       String[] paramTypes,
                                                       Object[] params)
                                                throws Throwable
Get a static method joinpoint

Parameters:
jpf - the join point factory
name - the name of the method
paramTypes - the parameter types
params - the parameters
Returns:
the join point
Throws:
Throwable - for any error

findConstructorInfo

public static ConstructorInfo findConstructorInfo(ClassInfo classInfo,
                                                  String[] paramTypes)
                                           throws JoinpointException
Find constructor info

Parameters:
classInfo - the class info
paramTypes - the parameter types
Returns:
the constructor info
Throws:
JoinpointException - when no such constructor

findFieldInfo

public static FieldInfo findFieldInfo(ClassInfo classInfo,
                                      String name)
                               throws JoinpointException
Find field info

Parameters:
classInfo - the class info
name - the field name
Returns:
the field info
Throws:
JoinpointException - when no such field

findMethodInfo

public static MethodInfo findMethodInfo(ClassInfo classInfo,
                                        String name,
                                        String[] paramTypes)
                                 throws JoinpointException
Find method info

Parameters:
classInfo - the class info
name - the method name
paramTypes - the parameter types
Returns:
the method info
Throws:
JoinpointException - when no such method

findMethodInfo

public static MethodInfo findMethodInfo(ClassInfo classInfo,
                                        String name,
                                        String[] paramTypes,
                                        boolean strict)
                                 throws JoinpointException
Find method info

Parameters:
classInfo - the class info
name - the method name
paramTypes - the parameter types
strict - is strict about method modifiers
Returns:
the method info
Throws:
JoinpointException - when no such method

findMethodInfo

public static MethodInfo findMethodInfo(ClassInfo classInfo,
                                        String name,
                                        String[] paramTypes,
                                        boolean isStatic,
                                        boolean isPublic)
                                 throws JoinpointException
Find method info

Parameters:
classInfo - the class info
name - the method name
paramTypes - the parameter types
isStatic - must the method be static
isPublic - must the method be public
Returns:
the method info
Throws:
JoinpointException - when no such method

findMethodInfo

public static MethodInfo findMethodInfo(ClassInfo classInfo,
                                        String name,
                                        String[] paramTypes,
                                        boolean isStatic,
                                        boolean isPublic,
                                        boolean strict)
                                 throws JoinpointException
Find method info

Parameters:
classInfo - the class info
name - the method name
paramTypes - the parameter types
isStatic - must the method be static
isPublic - must the method be public
strict - is strict about method modifiers
Returns:
the method info
Throws:
JoinpointException - when no such method

equals

public static boolean equals(String[] typeNames,
                             TypeInfo[] typeInfos)
Test whether type names are equal to type infos

Parameters:
typeNames - the type names
typeInfos - the type infos
Returns:
true when they are equal

simpleCheck

protected static boolean simpleCheck(String[] typeNames,
                                     TypeInfo[] typeInfos)
A simple null and length check.

Parameters:
typeNames - the type names
typeInfos - the type infos
Returns:
false if either argument is null or lengths differ, else true


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.