Package adams.core.discovery
Class IntrospectionHelper
- java.lang.Object
-
- adams.core.discovery.IntrospectionHelper
-
public class IntrospectionHelper extends Object
Helper class for introspection.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IntrospectionHelper.IntrospectionContainer
Simple container object for storing introspection information.
-
Field Summary
Fields Modifier and Type Field Description protected static Map<String,Boolean>
PROPERTY_CHECK_CACHE
the cache for "has property" checks.
-
Constructor Summary
Constructors Constructor Description IntrospectionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
hasProperty(Class cls, String name, Class type, boolean useBlacklist, UserMode userMode)
Checks whether the class has a property with the given name and type.static boolean
hasProperty(Class cls, String name, Class type, UserMode userMode)
Checks whether the class has a property with the given name and type.static IntrospectionHelper.IntrospectionContainer
introspect(Class cls, boolean useBlacklist, UserMode userMode)
Introspects the specified class.static IntrospectionHelper.IntrospectionContainer
introspect(Class cls, UserMode userMode)
Introspects the specified class.static IntrospectionHelper.IntrospectionContainer
introspect(Object obj, boolean useBlacklist, UserMode userMode)
Introspects the specified object.static IntrospectionHelper.IntrospectionContainer
introspect(Object obj, UserMode userMode)
Introspects the specified object.
-
-
-
Method Detail
-
introspect
public static IntrospectionHelper.IntrospectionContainer introspect(Object obj, UserMode userMode) throws Exception
Introspects the specified object. Uses the blacklist.- Parameters:
obj
- the object to introspectuserMode
- the user mode to use- Returns:
- the information gathered
- Throws:
Exception
- if introspection fails
-
introspect
public static IntrospectionHelper.IntrospectionContainer introspect(Class cls, UserMode userMode) throws Exception
Introspects the specified class. Uses the blacklist.- Parameters:
cls
- the class to introspectuserMode
- the user mode to use- Returns:
- the information gathered
- Throws:
Exception
- if introspection fails
-
introspect
public static IntrospectionHelper.IntrospectionContainer introspect(Object obj, boolean useBlacklist, UserMode userMode) throws Exception
Introspects the specified object.- Parameters:
obj
- the object to introspectuseBlacklist
- whether to apply the GOE blacklistuserMode
- the user mode to use- Returns:
- the information gathered
- Throws:
Exception
- if introspection fails
-
introspect
public static IntrospectionHelper.IntrospectionContainer introspect(Class cls, boolean useBlacklist, UserMode userMode) throws Exception
Introspects the specified class.- Parameters:
cls
- the class to introspectuseBlacklist
- whether to apply the GOE blacklist- Returns:
- the information gathered
- Throws:
Exception
- if introspection fails
-
hasProperty
public static boolean hasProperty(Class cls, String name, Class type, UserMode userMode)
Checks whether the class has a property with the given name and type.- Parameters:
cls
- the class to inspectname
- the name of the property to look fortype
- the type that the property must have, can be nulluserMode
- the user mode to apply- Returns:
- true if the class has that property
-
hasProperty
public static boolean hasProperty(Class cls, String name, Class type, boolean useBlacklist, UserMode userMode)
Checks whether the class has a property with the given name and type.- Parameters:
cls
- the class to inspectname
- the name of the property to look fortype
- the type that the property must have, can be nulluseBlacklist
- whether to apply the blacklistuserMode
- the user mode to apply- Returns:
- true if the class has that property
-
-