public final class AnnotationAcceptingListener extends Object implements ResourceProcessor
Java classes of a Java class file are processed, using ASM, to ascertain if those classes are annotated with one or more of the set of declared annotations.
Such an annotated Java class of a Java class file is loaded if the class is public or is an inner class that is static and public.
Constructor and Description |
---|
AnnotationAcceptingListener(Class<? extends Annotation>... annotations)
Create a scanner listener to check for annotated Java classes in Java
class files.
|
AnnotationAcceptingListener(ClassLoader classloader,
Class<? extends Annotation>... annotations)
Create a scanner listener to check for annotated Java classes in Java
class files.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(String name)
Accept a scanned resource.
|
Set<Class<?>> |
getAnnotatedClasses()
Get the set of annotated classes.
|
static AnnotationAcceptingListener |
newJaxrsResourceAndProviderListener()
|
static AnnotationAcceptingListener |
newJaxrsResourceAndProviderListener(ClassLoader classLoader)
|
void |
process(String name,
InputStream in)
Process a scanned resource.
|
public AnnotationAcceptingListener(Class<? extends Annotation>... annotations)
annotations
- the set of annotation classes to check on Java class
files.public AnnotationAcceptingListener(ClassLoader classloader, Class<? extends Annotation>... annotations)
classloader
- the class loader to use to load Java classes that
are annotated with any one of the annotations.annotations
- the set of annotation classes to check on Java class
files.public static AnnotationAcceptingListener newJaxrsResourceAndProviderListener()
Path
or Provider
.AnnotationAcceptingListener
which looks for
Path
or Provider
annotated classes.public static AnnotationAcceptingListener newJaxrsResourceAndProviderListener(ClassLoader classLoader)
Path
or Provider
.classLoader
- the class loader to use to load Java classes that
are annotated with any one of the annotations.AnnotationAcceptingListener
which looks for
Path
or Provider
annotated classes.public Set<Class<?>> getAnnotatedClasses()
public boolean accept(String name)
ResourceProcessor
accept
in interface ResourceProcessor
name
- the resource name.public void process(String name, InputStream in) throws IOException
ResourceProcessor
This method will be invoked after the listener has accepted the resource.
process
in interface ResourceProcessor
name
- the resource name.in
- the input stream of the resourceIOException
- if an error occurs when processing the resource.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.