de.kruis.padoclet
Class FilterDocletBase.Option

java.lang.Object
  extended by de.kruis.padoclet.util.AbstractOption
      extended by de.kruis.padoclet.FilterDocletBase.Option
Enclosing class:
FilterDocletBase

protected static class FilterDocletBase.Option
extends AbstractOption

Option handling for doclets. This class holds static methods and data about the options given to the doclet. Additionally instances oft the class represent single options.


Field Summary
static java.lang.String namePrefix
          all filter doclet options start with this string.
private static java.util.Map<java.lang.String,AbstractOption> options
          holds a (sorted) map of all known options
 
Fields inherited from class de.kruis.padoclet.util.AbstractOption
defaultValue, description, isBoolean, isTag, LF, LI, name, TAG_DELIMITER, value
 
Constructor Summary
FilterDocletBase.Option(java.lang.String name, java.lang.String description)
          Create a new option, that has no value (boolean option).
FilterDocletBase.Option(java.lang.String name, java.lang.String defaultValue, boolean isTag, java.lang.String description)
          Create a new option, that has a value.
 
Method Summary
static AbstractOption get(java.lang.String name)
          Get an option by name.
static java.lang.String getDescriptions()
          Get a string made from the descriptions of all registered options.
static java.util.Set<java.lang.String> getTags()
          Get all tags
static void initJavaBeanProperties(java.lang.Object bean)
          Assign option values to matching bean properties.
static void initOptions(java.lang.String[][] docletoptions)
          Initialize the option values.
static int optionLength(java.lang.String name)
          Get the number of parameters this option takes.
static void register(AbstractOption option)
          Register an option.
 
Methods inherited from class de.kruis.padoclet.util.AbstractOption
get, getDescriptions, getTags, initJavaBeanProperties, initOptions, isSet, optionLength, register, toString
 

Field Detail

namePrefix

public static final java.lang.String namePrefix
all filter doclet options start with this string.

See Also:
Constant Field Values

options

private static java.util.Map<java.lang.String,AbstractOption> options
holds a (sorted) map of all known options

Constructor Detail

FilterDocletBase.Option

public FilterDocletBase.Option(java.lang.String name,
                               java.lang.String defaultValue,
                               boolean isTag,
                               java.lang.String description)
Create a new option, that has a value.

Parameters:
name - the name
defaultValue - the default value
isTag - set to true, if the value of the option names a tag.
description - the description of the option

FilterDocletBase.Option

public FilterDocletBase.Option(java.lang.String name,
                               java.lang.String description)
Create a new option, that has no value (boolean option).

Parameters:
name - the name
description - the description of the option.
Method Detail

register

public static void register(AbstractOption option)
Register an option. This method is intended to be used from a static initializer. It let you define the set of possible option.

Parameters:
option - the option to register.

get

public static AbstractOption get(java.lang.String name)
Get an option by name.

Parameters:
name - the name of the option.
Returns:
the option object. Returns null, if no option with the given name was registered.

getDescriptions

public static java.lang.String getDescriptions()
Get a string made from the descriptions of all registered options.

Returns:
the compiled descriptions.

getTags

public static java.util.Set<java.lang.String> getTags()
Get all tags

Returns:
a set containing all tag names, that is the values of all options where the property isTag is set.

optionLength

public static int optionLength(java.lang.String name)
Get the number of parameters this option takes.

Parameters:
name - the name of the option.
Returns:
1, if the option takes no parameters, 2, if the option takes a parameter. If the option is unknown, return 0.

initOptions

public static void initOptions(java.lang.String[][] docletoptions)
Initialize the option values.

Parameters:
docletoptions - the options as provided by the javadoc core.
See Also:
Doclet.validOptions(java.lang.String[][], com.sun.javadoc.DocErrorReporter), RootDoc.options()

initJavaBeanProperties

public static void initJavaBeanProperties(java.lang.Object bean)
                                   throws java.lang.Throwable
Assign option values to matching bean properties. For each setable property of the Java bean, this method looks for an option with the same name. If such an option exists, the property is set to the value of the option. Currently only beans of the types String, boolen and int are supported.

Parameters:
bean - a java bean
Throws:
java.lang.Throwable