Class HelpGenerator.AnnotationDescriptionPlugin<T extends Annotation>

java.lang.Object
com.mastfrog.acteur.HelpGenerator.AnnotationDescriptionPlugin<T>
Type Parameters:
T -
Enclosing class:
HelpGenerator

public abstract static class HelpGenerator.AnnotationDescriptionPlugin<T extends Annotation> extends Object
Allows code to be plugged in to contribute to the help page information about specific types of annotation. To plug one in, implement and bind as an eager singleton.
  • Constructor Details

    • AnnotationDescriptionPlugin

      protected AnnotationDescriptionPlugin(Class<T> annotationType, HelpGenerator gen)
  • Method Details

    • deConstantNameify

      protected final String deConstantNameify(String s)
      Convert typical Java constant naming conventions - e.g. FOO_BAR_BAZ into a documentation-friendly string "Foo Bar Baz".
      Parameters:
      s - The string
      Returns:
      A munged version of the passed strings
    • introspectAnnotation

      protected final void introspectAnnotation(Application application, Annotation a, Map<String,Object> into) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
      Introspect, continuing the help mechanism, an annotation found when examining the annotation passed to write() (but must not be the annotation passed there). If your annotation, say, inserts additional Acteurs in the chain, whose behavior should be reflected in the help - @Precursors and &#064Concluders are examples of this - call this method to automatically look up and use any plugins needed. Typically, your write() method will create and add a new sub-map which you pass to this method, to the map you were passed.
      Parameters:
      application - The application instance
      a - The annotation
      into - The map to write into
      Throws:
      IllegalAccessException - If reflection fails
      IllegalArgumentException - If reflection fails
      InvocationTargetException - If reflection fails
    • reflectAndJsonify

      protected final String reflectAndJsonify(Application application, String field, Class<?> type)
      Used for examples - looks up the given static field by reflection and returns an html-ized JSONified view of its contents.
      Parameters:
      application - The application
      field - The field name
      type - The type the field is on
      Returns:
      A description or null if something goes wrong
    • write

      protected abstract void write(Application application, Map<String,Object> addTo, T anno)
      Add key/value pairs to the passed map, describing this annotation, for the JSON help description.
      Parameters:
      addTo - The map to add to
      anno - The annotation