|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vostok.lang.classes.ClassFinder
public class ClassFinder
this class provide method to look for classes implementing, or extending a specific class, interface or annotation.
ClassFinder has a cache implementation. Scanning is memmory and cpu consuming process, so don't disable the cache unless it's really important.
for annoation, only able to locate annotation set on a specific class (therefore not on a super class) and must be RetentionPolicy.RUNTIME and ElementType.CONSTRUCTOR
ClassLoader
Constructor Summary | |
---|---|
ClassFinder(boolean cache)
create a new finder using the default class loader. |
|
ClassFinder(java.lang.ClassLoader loader,
boolean cache)
create a new finder using a specific class loader. |
|
ClassFinder(java.lang.ClassLoader loader,
java.lang.String path,
boolean cache)
create a new finder using a specific class loader. |
|
ClassFinder(java.lang.String path)
create a new class finder, using cahce and stating scanning down to 'path' |
Method Summary | |
---|---|
static boolean |
doesImplement(java.lang.Class cl,
java.lang.Class target)
check if a class - or its parents - implement or extend an other class. |
java.lang.Class |
doMatch(java.lang.String key,
java.io.InputStream is,
java.lang.Class target)
You don't have to use this method. public from interface but only for internal use. |
java.lang.ClassLoader |
getClassLoader()
return the current ClassLoader this ClassFinder uses. |
static ClassFinder |
getDefaultInstance()
return the default ClasssFinder. |
java.lang.Class[] |
whoImplement(java.lang.Class target)
Find all classes using 'target'. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassFinder(java.lang.String path)
path
- package to start scanning from. Can be null and dot or slash formed (ie foo.bar or foo/bar)public ClassFinder(java.lang.ClassLoader loader, java.lang.String path, boolean cache)
loader
- path
- package to start scanning from. Can be null and dot or slash formed (ie foo.bar or foo/bar)cache
- if false, will no cache resultpublic ClassFinder(java.lang.ClassLoader loader, boolean cache)
loader
- cache
- if false, will no cache resultpublic ClassFinder(boolean cache)
if cache==true, any result will be cached for further request.
nota : scanning is mempory and cpu consuming process. disabling the cache is not recommended.
if you need it, prefer ClassFinder(ClassLoader loader, boolean cache)
cache
- if false, will no cache resultMethod Detail |
---|
public static ClassFinder getDefaultInstance()
Use this method unled you really want to extend your own ClassLoader, or you want to extend the application with non system classes directory
DynamicClassLoader
public java.lang.ClassLoader getClassLoader()
public java.lang.Class[] whoImplement(java.lang.Class target) throws java.io.IOException
target
- base class / interface to look for
java.io.IOException
public java.lang.Class doMatch(java.lang.String key, java.io.InputStream is, java.lang.Class target) throws java.io.IOException
key
- is
- target
-
java.io.IOException
public static boolean doesImplement(java.lang.Class cl, java.lang.Class target)
cl
- class to look attarget
- class to look for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |