|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.zmicer.utils.ReflexionUtils
public class ReflexionUtils
Utility class for working with reflexion mechanism
$Author:: zmicer $
Field Summary | |
---|---|
static org.apache.log4j.Logger |
LOG
Logger instance. |
static Pattern |
PATTERN
Pattern to find the name of the method is currently running. |
Constructor Summary | |
---|---|
ReflexionUtils()
|
Method Summary | |
---|---|
static String |
getBaseName(Class claz)
Get the base name of the provided String - the name of the class. |
static String |
getCallerFullClassName()
note [zmicer]: only for the test purposes (for JPatterns test engine allowing to setup the props/xml environment per the folders) |
static String |
getClassNameOfArrayMembers(Class claz)
Get the full name of the class from instances of which the certain array object class of which is passed as the single input param. |
static boolean |
instanceOf(Object obj,
Class<?> baseClass)
Analog of the instance of construction (e.g. obj instanceof Serializable) |
static Object |
reflectObject(String className,
boolean throwIfNotInitialized)
Get the instance of Object using the provided full class name. |
static Map<String,Object> |
reflectObjects(Map<String,String> info,
boolean throwIfNotInitialized)
Get the instance of Object using the provided full class name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger LOG
public static final Pattern PATTERN
Constructor Detail |
---|
public ReflexionUtils()
Method Detail |
---|
public static Object reflectObject(String className, boolean throwIfNotInitialized)
null
is returned.
className
- the full class name ro be reflected, Can not be null (otherwise IllegalArgumentException
would appear).throwIfNotInitialized
- if this is true we throw exception (IllegalStateException) if some implementations can not be
instantiated
public static Map<String,Object> reflectObjects(Map<String,String> info, boolean throwIfNotInitialized)
null
is returned as the value.
info
- the map with #key type of the object to be reflected #value. Can not contains null as neither key or value
Can not be null (otherwise IllegalArgumentException
would appear).throwIfNotInitialized
- if this is true we throw exception (IllegalStateException) if some implementations can not be
instantiated
public static String getBaseName(Class claz)
claz
- Class
instance. Can not be null (otherwise IllegalArgumentException
would appear).
public static String getClassNameOfArrayMembers(Class claz)
Global
object. This appropriate class for this array would have the name
"[Lcom.sourceforge.jpatterns.schema.Global;", and String we need is "com.sourceforge.jpatterns.schema.Global".
claz
- Class of an array for which we need to determine the class of the objects this array stores.
Can not be null (otherwise IllegalArgumentException
would appear).
In the case the class provided do not correspond to the array of objects the IllegalArgumentException would appear too.
public static String getCallerFullClassName()
public static boolean instanceOf(Object obj, Class<?> baseClass)
obj
- object to be checked. Can not be null (otherwise IllegalArgumentException
would appear).baseClass
- base class (interface class) which should be used for the determining if obj is instace of this class
Can not be null (otherwise IllegalArgumentException
would appear).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |