Enhydra 5.1 API

org.enhydra.tool.codegen
Class GeneratorOption

java.lang.Object
  |
  +--org.enhydra.tool.codegen.GeneratorOption

public class GeneratorOption
extends java.lang.Object

GeneratorOption define a generator specific option for CodeGen. Generation options include information such as the directory where to generate an application and name to use for the generated application.


Constructor Summary
GeneratorOption(java.lang.String n, boolean v, java.lang.String desc, boolean persist)
          Create a option for the current generator.
GeneratorOption(java.lang.String name, java.lang.String value, java.lang.String displayName, java.lang.String description, boolean required, boolean persistent)
          Create a option for the current generator.
 
Method Summary
 void clearValue()
           
 java.lang.String getDescription()
          Get a string describing the option.
 java.lang.String getDisplayName()
          Get name to display in Swing components.
 java.lang.String getName()
          Get the option name.
 java.lang.String getValue()
          Get the option value.
 boolean isBoolean()
          Determine if the option is a boolean switch.
 boolean isEmpty()
           
 boolean isPersistent()
          Check if the option value persistent between CodeGen sessions.
 boolean isRequired()
          Flag indicating if the values needs to be set prior to generation.
 boolean isValue()
          Get the value as a boolean.
 void setValue(boolean value)
          Set the value as a boolean.
 void setValue(java.lang.String value)
          Set the option value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorOption

public GeneratorOption(java.lang.String name,
                       java.lang.String value,
                       java.lang.String displayName,
                       java.lang.String description,
                       boolean required,
                       boolean persistent)
                throws GeneratorException
Create a option for the current generator. Generators normally instantiate an array of options during initialization.

Parameters:
name - When passing command line arguments, the name must be prefixed with a dash.
value - When the name refers to a boolean flag, any value other than 'true' should be treated as 'false'.
description - The description is what displays when help for the option is printed out from the command line. The description may also be used in a wizard panel.
required - True if a value for this option must be specified for the generation to be successful.
Throws:
GeneratorException - Thrown if name is a null or an empty string. Note that no exception is thrown during construction if required is true and the value is null or empty.

GeneratorOption

public GeneratorOption(java.lang.String n,
                       boolean v,
                       java.lang.String desc,
                       boolean persist)
                throws GeneratorException
Create a option for the current generator. Generators normally instantiate an array of options during initialization.

Throws:
GeneratorException - Thrown if name is a null or an empty string. Note that no exception is thrown during construction if required is true and the value is null or empty.
Method Detail

getName

public java.lang.String getName()
Get the option name. This should be a terse name used for command line and referencing within generator code. This terse format of indicating the option should not be displayed in a wizard.

Returns:
The option name. Prefix this with a dash for command line usage.

getValue

public java.lang.String getValue()
Get the option value.

Returns:
For boolean flags, treat any value other than 'true' as 'false'.

setValue

public void setValue(java.lang.String value)
              throws GeneratorException
Set the option value. The value can be set when processing arguments from the command line or during the writeOptions() method of an CodeGenPanel.

Parameters:
value - String value for the option.
Throws:
GeneratorException - Thrown if value is null or empty and required is true.

setValue

public void setValue(boolean value)
Set the value as a boolean.

Parameters:
value - Boolean value.

getDescription

public java.lang.String getDescription()
Get a string describing the option. The description is displayed by command line help and may be used for wizard panels.

Returns:
Descriptive text. String length should not be longer than 512 characters.

isRequired

public boolean isRequired()
Flag indicating if the values needs to be set prior to generation. Ignore this flag when dealing with boolean generation options.

Returns:
If true, the generator requires that the value not be null or an empty string.

isPersistent

public boolean isPersistent()
Check if the option value persistent between CodeGen sessions.

Returns:
True if the value is persisted between CodeGen sessions.

getDisplayName

public java.lang.String getDisplayName()
Get name to display in Swing components.

Returns:
String to display in Swing components such as the generator selection combobox.

isValue

public boolean isValue()
Get the value as a boolean.

Returns:
Returns true if the value is 'true'.

isBoolean

public boolean isBoolean()
Determine if the option is a boolean switch.

Returns:
True if the option is a boolean.

clearValue

public void clearValue()

isEmpty

public boolean isEmpty()

Enhydra 5.1 API