Class ByteCodeFilter
java.lang.Object
org.ocpsoft.rewrite.annotation.scan.ByteCodeFilter
This class reads Java class files and checks whether they contain references to specific annotations. This allows to check classes for the presence of annotations before instantiating them.
The filter is inspired by the ClassByteCodeAnnotationFilter of Apache MyFaces 2.0. Many thanks go out to
Leonardo Uribe for his great work on this class.
- Author:
- Christian Kaltepoth
-
Constructor Summary
ConstructorsConstructorDescriptionByteCodeFilter(Set<Class<? extends Annotation>> types) The filter must be initialized with a list of types to look for when scanning the class files. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(InputStream classFileStream) Checks whether that suppliedInputStreamcontains a Java class file that might contain references to specific annotation types.toString()
-
Constructor Details
-
ByteCodeFilter
The filter must be initialized with a list of types to look for when scanning the class files. If a class files contains a reference to one of these types, the filter will accept the class.- Parameters:
types- A Set of types to look for
-
-
Method Details
-
accept
Checks whether that supplied
InputStreamcontains a Java class file that might contain references to specific annotation types.The caller of this method is responsible to close the supplied
InputStream. This method won't do it!- Parameters:
classFileStream- The stream to read the class file from.- Returns:
truefor files that contain at least one reference to one of the "interesting" annotations- Throws:
IOException- for any kind of IO problem
-
toString
-