org.hyphenType.documentation
Class DocumentationFormatterEngine<T extends Options<?>,V extends Annotation>

java.lang.Object
  extended by org.hyphenType.documentation.DocumentationFormatterEngine<T,V>
Type Parameters:
T - TODO
V - TODO
Direct Known Subclasses:
HTMLFormatterEngine, StandardFormatterEngine

public abstract class DocumentationFormatterEngine<T extends Options<?>,V extends Annotation>
extends Object

Author:
Aurelio Akira M. Matsui

Constructor Summary
protected DocumentationFormatterEngine()
           
 
Method Summary
static
<A extends Options<?>,B extends Annotation>
DocumentationFormatterEngine<A,B>
buildFormatter(Class<A> optionsInterface, Class<B> formatterAnnotationClass)
          Builds a formatter based on the options interface and the formatter annotation.
 V getAnnotation()
           
 String getMessage(String key, String defaultValue)
           
protected  String getOptionsInterfaceValue(String key)
          Retrieves messages from the resource bundles.
protected  String getOptionsInterfaceValue(String key, String defaultValue)
          Retrieves messages from the resource bundles.
protected  String getStatusCodeUserDescription(Enum<?> statusCode)
           
static DocumentationFormatterEngine preferredFormatter(Class<? extends Options<?>> optionsInterface)
          Builds the preferred formatter.
 void printDocumentation()
          Prints the documentation to the default stdout (System.out).
 void printDocumentation(PrintStream pw)
          Prints the documentation to the given PrintStream.
protected abstract  void printDocumentation(PrintStream pw, LexerParser<T> parser, V formatterAnnotation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentationFormatterEngine

protected DocumentationFormatterEngine()
Method Detail

getAnnotation

public final V getAnnotation()
Returns:
TODO

getMessage

public final String getMessage(String key,
                               String defaultValue)
Parameters:
key - TODO
defaultValue - TODO
Returns:
TODO

printDocumentation

public final void printDocumentation()
Prints the documentation to the default stdout (System.out).


printDocumentation

public final void printDocumentation(PrintStream pw)
Prints the documentation to the given PrintStream. Tip: A very convenient way to save the output to a file is to call
 
 printDocumentation(new PrintStream("file.name"));
 
 

Parameters:
pw - TODO

printDocumentation

protected abstract void printDocumentation(PrintStream pw,
                                           LexerParser<T> parser,
                                           V formatterAnnotation)
Parameters:
pw - TODO
parser - TODO
formatterAnnotation - TODO

getOptionsInterfaceValue

protected final String getOptionsInterfaceValue(String key,
                                                String defaultValue)
                                         throws StringParsingError
Retrieves messages from the resource bundles.

Parameters:
key - TODO
defaultValue - TODO
Returns:
TODO
Throws:
StringParsingError - TODO

getOptionsInterfaceValue

protected final String getOptionsInterfaceValue(String key)
                                         throws StringParsingError
Retrieves messages from the resource bundles.

Parameters:
key - TODO
Returns:
TODO
Throws:
StringParsingError - TODO

getStatusCodeUserDescription

protected final String getStatusCodeUserDescription(Enum<?> statusCode)
                                             throws StringParsingError
Parameters:
key - TODO
Returns:
TODO
Throws:
StringParsingError - TODO

preferredFormatter

public static DocumentationFormatterEngine preferredFormatter(Class<? extends Options<?>> optionsInterface)
Builds the preferred formatter. Either the one that is default for the options interface; the one chosen by the options interface user, which can be configured using properties files; or the default formatter, which is the default value of the property ArgumentsObject.preferredDocumentationFormatter().

Parameters:
optionsInterface - TODO
Returns:
TODO

buildFormatter

public static <A extends Options<?>,B extends Annotation> DocumentationFormatterEngine<A,B> buildFormatter(Class<A> optionsInterface,
                                                                                                           Class<B> formatterAnnotationClass)
Builds a formatter based on the options interface and the formatter annotation. Documentation formatters are referenced by their annotation, instead of its class.

Type Parameters:
A - The options interface class.
B - The documentation formatter annotation.
Parameters:
optionsInterface - The options interface class.
formatterAnnotationClass - The documentation formatter annotation.
Returns:
A new documentation formatter.


Copyright © 2013. All Rights Reserved.