FileDocCategorySizeDatePackage
ValidOption.javaAPI DocGlassfish v2 API7397Fri May 04 22:25:22 BST 2007com.sun.enterprise.cli.framework

ValidOption

public class ValidOption extends Object implements Serializable
Definition for the valid option
version
$Revision: 1.5 $

Fields Summary
private String
name
private Vector
shortNames
private String
type
private int
required
private String
defaultValue
private String
deprecatedOption
public static final int
REQUIRED
public static final int
OPTIONAL
public static final int
NOT_REQUIRED
Constructors Summary
public ValidOption()
Creates new ValidOption

    
    
        
      
    
    
public ValidOption(String name, String type, int required, String defaultValue)
Overloaded constructor for ValidOption

param
name the name of the option
param
type the datatype of this option
param
required specifies if the value for this option is required or optional
param
defaultValue the default value for this option if nonce specified on command line

        this.name = name;
        this.type = type;
        this.required = required;
        this.defaultValue = defaultValue;
    
public ValidOption(ValidOption vo)
copy constructor for ValidOption

param
vo

        this.name = vo.name;
        this.shortNames = vo.shortNames;
        this.type = vo.type;
        this.required = vo.required; 
        this.defaultValue = vo.defaultValue;
        this.deprecatedOption = vo.deprecatedOption;
    
Methods Summary
public java.lang.StringgetDefaultValue()
Returns the default value of the option

return
the default value

        return defaultValue;
    
public java.lang.StringgetDeprecatedOption()
Returns the deprecated option

return
the deprecated option

        return deprecatedOption;
    
public java.lang.StringgetName()
Gets the name of the option

return
the name of the option

        return name;
    
public java.util.VectorgetShortNames()
Returns the short name of the option

return
the short name

        return shortNames;
    
public java.lang.StringgetType()
Returns the type of the option value

return
the type

        return type;
    
public booleanhasDefaultValue()
Checks to see if there is a default value for this option

return
if there is a default value

        return (defaultValue != null);
    
public booleanhasDeprecatedOption()
Checks to see if there is a default value for this option

return
if there is a default value

        return (deprecatedOption != null);
    
public booleanhasShortName()
Checks to see if there is a short option name for this option

return
if there is a short option name

        if (shortNames.size() > 0)
        {
            return true;
        }
        return false;
    
public intisValueRequired()
Checks to see if the value is required

return
the value required

        return required;
    
public voidsetDefaultValue(java.lang.String defaultValue)
Sets the default value of the option

param
defaultValue the default value to set

        this.defaultValue = defaultValue;
    
public voidsetDeprecatedOption(java.lang.String deprecatedOption)
Sets the deprecated option

param
deprecatedOption option value

        this.deprecatedOption = deprecatedOption;
    
public voidsetName(java.lang.String name)
Sets the name of the option

param
name name of the option to set

        this.name = name;
    
public voidsetRequired(int isValueRequired)
Sets the required field of the option

param
isValueRequired the value to set

        required = isValueRequired;
    
public voidsetShortName(java.lang.String shortName)
Sets the short option name

param
shortName short name to set

        this.shortNames.add(shortName);
    
public voidsetShortNames(java.util.Vector shortNames)
Sets the short option names

param
shortNames short names to set

        this.shortNames.addAll(shortNames);
    
public voidsetType(java.lang.String type)
Sets the type of the option value

param
type the type to set

        this.type = type;
    
public java.lang.StringtoString()
converts the object to string returns toString() of this object

        String shortNamesStr = "";
        
        for (int i = 0; i < shortNames.size(); i++)
        {
            shortNamesStr += shortNames.get(i) + ",";
        }
        return (name + " " + type + " " + shortNamesStr + " " + defaultValue);