AnnotationHandler
Interface
A customisable handler for parsing annotations. This can be used to add extra details to the output.
These handlers are specific to an output schema.
Modifiers
public abstract
class MyHandler implements AnnotationHandler {
@Override
public boolean accepts(Annotation annotation) {
return annotation instanceof Example;
}
@Override
public void parse(Annotation annotation, OutputStream target) {
// pretty print the data here
}
}
Methods
state ()
MethodThe state where this is to be printed. This is designed for use with the website schema.
Return Type
State
Modifiers
public
parse (Annotation, OutputStream)
Abstract MethodPretty-writes the content of this annotation to the output stream. This will not differentiate between the single and multiple form of the annotation.
Index | Type | Name |
---|---|---|
1 | Annotation | annotation |
2 | OutputStream | stream |
Return Type
void
Modifiers
public abstract
accepts (Annotation)
Abstract MethodDetermines whether this handler can process the given annotation. This can be used as a type (or multi-type check.)
If this passes, the parse method will be called.
Index | Type | Name |
---|---|---|
1 | Annotation | annotation |
Return Type
boolean
Modifiers
public abstract
public boolean accepts(Annotation annotation) {
return annotation instanceof MyAnnotation;
}