org.eclipse.jetty.annotations

## Class AnnotationParser

- java.lang.Object
- - org.eclipse.jetty.annotations.AnnotationParser

    public class AnnotationParser
    extends Object

AnnotationParser Use asm to scan classes for annotations. A SAX-style parsing is done, with a handler being able to be registered to handle each annotation type.

### Nested Class Summary

Nested Classes
`static interface` `AnnotationParser.ClassHandler` ClassHandler Responds to finding a Class
`static interface` `AnnotationParser.DiscoverableAnnotationHandler` DiscoverableAnnotationHandler Processes an annotation when it is discovered on a class.
`static interface` `AnnotationParser.FieldHandler` FieldHandler Responds to finding a Field
`static interface` `AnnotationParser.Handler` Handler Signature for all handlers that respond to parsing class files.
`class` `AnnotationParser.ListValue`
`static interface` `AnnotationParser.MethodHandler` MethodHandler Responds to finding a Method
`class` `AnnotationParser.MyAnnotationVisitor` MyAnnotationVisitor ASM Visitor for Annotations
`class` `AnnotationParser.MyClassVisitor` MyClassVisitor ASM visitor for a class.
`class` `AnnotationParser.SimpleValue`
`class` `AnnotationParser.Value`

### Field Summary

Fields
`protected List<AnnotationParser.Handler>` `_handlers`
`protected Set<String>` `_parsedClassNames`

### Constructor Summary

Constructors
Constructor and Description
`AnnotationParser()`

### Method Summary

Methods
`void` `clearHandlers()` Remove all registered handlers
`boolean` `deregisterHandler(AnnotationParser.Handler h)` Remove a particular handler
`List<AnnotationParser.DiscoverableAnnotationHandler>` `getAnnotationHandlers()` Deprecated.
`List<AnnotationParser.DiscoverableAnnotationHandler>` `getAnnotationHandlers(String annotationName)` Deprecated.
`boolean` `isParsed(String className)` True if the class has already been processed, false otherwise
`static String` `normalize(String name)`
`void` `parse(Class clazz, ClassNameResolver resolver, boolean visitSuperClasses)` Parse the given class, optionally walking its inheritance hierarchy
`void` `parse(ClassLoader loader, boolean visitParents, boolean nullInclusive, ClassNameResolver resolver)` Parse classes in the supplied classloader.
`void` `parse(List<String> classNames, ClassNameResolver resolver)` Parse the given classes
`void` `parse(Resource dir, ClassNameResolver resolver)` Parse all classes in a directory
`void` `parse(String[] classNames, ClassNameResolver resolver)` Parse the given classes
`void` `parse(String className, ClassNameResolver resolver)` Parse a given class
`void` `parse(URI[] uris, ClassNameResolver resolver)` Parse classes in the supplied url of jar files.
`void` `parse(URI uri, ClassNameResolver resolver)` Parse a particular resource
`void` `registerAnnotationHandler(String annotationName, AnnotationParser.DiscoverableAnnotationHandler handler)` Deprecated. see registerHandler(Handler)
`void` `registerClassHandler(AnnotationParser.ClassHandler handler)` Deprecated. see registerHandler(Handler)
`void` `registerHandler(AnnotationParser.Handler h)` Add a particular handler
`void` `registerHandlers(List<? extends AnnotationParser.Handler> handlers)` Add a list of handlers
`protected void` `scanClass(InputStream is)` Use ASM on a class

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### _parsedClassNames

    protected Set<String> _parsedClassNames

#### _handlers

    protected List<AnnotationParser.Handler> _handlers

### Constructor Detail

#### AnnotationParser

    public AnnotationParser()

### Method Detail

#### normalize

    public static String normalize(String name)

#### registerAnnotationHandler

    public void registerAnnotationHandler(String annotationName,
                                 AnnotationParser.DiscoverableAnnotationHandler handler)

Deprecated. see registerHandler(Handler)
Register a handler that will be called back when the named annotation is encountered on a class.

Parameters:
  `annotationName` -
  `handler` -

#### getAnnotationHandlers

    public List<AnnotationParser.DiscoverableAnnotationHandler> getAnnotationHandlers(String annotationName)

Deprecated.

Parameters:
  `annotationName` -
Returns:

#### getAnnotationHandlers

    public List<AnnotationParser.DiscoverableAnnotationHandler> getAnnotationHandlers()

Deprecated.

Returns:

#### registerClassHandler

    public void registerClassHandler(AnnotationParser.ClassHandler handler)

Deprecated. see registerHandler(Handler)

Parameters:
  `handler` -

#### registerHandler

    public void registerHandler(AnnotationParser.Handler h)

Add a particular handler

Parameters:
  `h` -

#### registerHandlers

    public void registerHandlers(List<? extends AnnotationParser.Handler> handlers)

Add a list of handlers

Parameters:
  `handlers` -

#### deregisterHandler

    public boolean deregisterHandler(AnnotationParser.Handler h)

Remove a particular handler

Parameters:
  `h` -
Returns:

#### clearHandlers

    public void clearHandlers()

Remove all registered handlers

#### isParsed

    public boolean isParsed(String className)

True if the class has already been processed, false otherwise

Parameters:
  `className` -
Returns:

#### parse

    public void parse(String className,
             ClassNameResolver resolver)
               throws Exception

Parse a given class

Parameters:
  `className` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(Class clazz,
             ClassNameResolver resolver,
             boolean visitSuperClasses)
               throws Exception

Parse the given class, optionally walking its inheritance hierarchy

Parameters:
  `clazz` -
  `resolver` -
  `visitSuperClasses` -
Throws:
  `Exception`

#### parse

    public void parse(String[] classNames,
             ClassNameResolver resolver)
               throws Exception

Parse the given classes

Parameters:
  `classNames` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(List<String> classNames,
             ClassNameResolver resolver)
               throws Exception

Parse the given classes

Parameters:
  `classNames` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(Resource dir,
             ClassNameResolver resolver)
               throws Exception

Parse all classes in a directory

Parameters:
  `dir` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(ClassLoader loader,
             boolean visitParents,
             boolean nullInclusive,
             ClassNameResolver resolver)
               throws Exception

Parse classes in the supplied classloader. Only class files in jar files will be scanned.

Parameters:
  `loader` -
  `visitParents` -
  `nullInclusive` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(URI[] uris,
             ClassNameResolver resolver)
               throws Exception

Parse classes in the supplied url of jar files.

Parameters:
  `uris` -
  `resolver` -
Throws:
  `Exception`

#### parse

    public void parse(URI uri,
             ClassNameResolver resolver)
               throws Exception

Parse a particular resource

Parameters:
  `uri` -
  `resolver` -
Throws:
  `Exception`

#### scanClass

    protected void scanClass(InputStream is)
                      throws IOException

Use ASM on a class

Parameters:
  `is` -
Throws:
  `IOException`