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 ()

Method

The 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 Method

Pretty-writes the content of this annotation to the output stream. This will not differentiate between the single and multiple form of the annotation.

IndexTypeName
1Annotationannotation
2OutputStreamstream
Return Type

void

Modifiers

public abstract

accepts (Annotation)

Abstract Method

Determines 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.

IndexTypeName
1Annotationannotation
Return Type

boolean

Modifiers

public abstract

public boolean accepts(Annotation annotation) {
    return annotation instanceof MyAnnotation;
}