Class IntrospectionUtils
java.lang.Object
org.apache.commons.modeler.util.IntrospectionUtils
Utils for introspection and reflection
Source: jakarta-tomcat-connector/util
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddJarsFromClassPath(Vector jars, String cp) add elements from the classpath cp to a Vector jars as file URLs (We use Vector for JDK 1.1 compat).static voidaddToClassPath(Vector cpV, String dir) Add all the jar files in a dir to the classpath, represented as a Vector of URLs.static voidstatic voidstatic ObjectcallMethod0(Object target, String methodN) static ObjectcallMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) static ObjectcallMethodN(Object target, String methodN, Object[] params, Class[] typeParams) static Stringcapitalize(String name) Reverse of Introspector.decapitalizestatic StringclassPathAdd(URL[] urls, String cp) Adds classpath entries from a vector of URL's to the "tc_path_add" System property.static voidclear()(package private) static voidstatic voiddisplayClassPath(String msg, URL[] cp) Debug method, display the classpathstatic voidExecute a no-param method.static String[]static MethodfindMethod(Class c, String name, Class[] params) static Method[]findMethods(Class c) static String[]static ObjectgetAttribute(Object proxy, String n) Call void getAttribute( String )static URL[]getClassPath(String dir, String cpath, String cpathProp, boolean addTools) Construct a URL classpath from files in a directory, a cpath property, and tools.jar.static URL[]Return a URL[] that can be used to construct a class loaderstatic String[]getFilesByExt(String ld, String ext) Return all files with a given extension in a dirstatic ObjectgetProperty(Object o, String name) static URLConstruct a file url from a file, using a base dirstatic ClassLoadergetURLClassLoader(URL[] urls, ClassLoader parent) Construct a URLClassLoader.static StringguessInstall(String installSysProp, String homeSysProp, String jarName) static StringguessInstall(String installSysProp, String homeSysProp, String jarName, String classFile) Guess a product install/home by analyzing the class path.static booleanTest if the object implements a particular methodstatic booleanprocessArgs(Object proxy, String[] args) static booleanstatic StringreplaceProperties(String value, Object getter) Deprecated.Use the explicit methodstatic StringreplaceProperties(String value, Hashtable staticProp, IntrospectionUtils.PropertySource[] dynamicProp) Replace ${NAME} with the property valuestatic voidsetAttribute(Object proxy, String n, Object v) Call void setAttribute( String ,Object )static voidsetProperty(Object o, String name) static voidsetProperty(Object o, String name, String value) Find a method with the right name If found, call the method ( if param is int or boolean we'll convert value to the right type before) - that means you can have setDebug(1).static StringunCapitalize(String name)
-
Field Details
-
NO_PARAMS
-
STRING_OBJ_PARAM
-
STRING_PARAM
-
PATH_SEPARATOR
-
objectMethods
-
emptyArray
-
dbg
static final int dbg- See Also:
-
-
Constructor Details
-
IntrospectionUtils
public IntrospectionUtils()
-
-
Method Details
-
execute
-
setAttribute
-
getAttribute
-
getURLClassLoader
Construct a URLClassLoader. Will compile and work in JDK1.1 too. -
guessInstall
-
guessInstall
public static String guessInstall(String installSysProp, String homeSysProp, String jarName, String classFile) Guess a product install/home by analyzing the class path. It works for product using the pattern: lib/executable.jar or if executable.jar is included in classpath by a shell script. ( java -jar also works ) Insures both "install" and "home" System properties are set. If either or both System properties are unset, "install" and "home" will be set to the same value. This value will be the other System property that is set, or the guessed value if neither is set. -
displayClassPath
-
classPathAdd
Adds classpath entries from a vector of URL's to the "tc_path_add" System property. This System property lists the classpath entries common to web applications. This System property is currently used by Jasper when its JSP servlet compiles the Java file for a JSP. -
setProperty
-
getProperty
-
setProperty
-
replaceProperties
-
replaceProperties
public static String replaceProperties(String value, Hashtable staticProp, IntrospectionUtils.PropertySource[] dynamicProp) Replace ${NAME} with the property value -
capitalize
-
unCapitalize
-
addToClassPath
-
addToolsJar
-
getFilesByExt
-
getURL
-
addJarsFromClassPath
public static void addJarsFromClassPath(Vector jars, String cp) throws IOException, MalformedURLException add elements from the classpath cp to a Vector jars as file URLs (We use Vector for JDK 1.1 compat).- Parameters:
jars- A vector of URLscp- a String classpath of directory or jar file elements separated by path.separator delimiters.- Throws:
IOExceptionMalformedURLException
-
getClassPath
-
getClassPath
public static URL[] getClassPath(String dir, String cpath, String cpathProp, boolean addTools) throws IOException, MalformedURLException Construct a URL classpath from files in a directory, a cpath property, and tools.jar.- Throws:
IOExceptionMalformedURLException
-
processArgs
-
processArgs
-
findVoidSetters
-
findBooleanSetters
-
clear
public static void clear() -
findMethods
-
findMethod
-
hasHook
-
callMain
-
callMethod1
-
callMethod0
-
callMethodN
-
d
-