com.sun.slamd.parameter
Class StringParameter

java.lang.Object
  extended bycom.sun.slamd.parameter.Parameter
      extended bycom.sun.slamd.parameter.StringParameter
All Implemented Interfaces:
java.lang.Cloneable

public class StringParameter
extends Parameter

This class defines a String parameter whose value is simple text. The HTML input mechanism for this parameter is an edit field.


Field Summary
 
Fields inherited from class com.sun.slamd.parameter.Parameter
description, displayName, isRequired, name, value
 
Constructor Summary
StringParameter()
          Creates a new instance of the Parameter to be used when decoding values transported over the network, and should not be used by jobs to create parameters.
StringParameter(java.lang.String name)
          Creates a new String parameter with the specified name.
StringParameter(java.lang.String name, boolean isRequired)
          Creates a new String parameter with the specified name and required/optional indicator.
StringParameter(java.lang.String name, boolean isRequired, java.lang.String value)
          Creates a new String parameter with the specified name, value, and required/optional indicator.
StringParameter(java.lang.String name, java.lang.String value)
          Creates a new String parameter with the specified name and value.
StringParameter(java.lang.String name, java.lang.String displayName, boolean isRequired, java.lang.String value)
          Creates a new String parameter with the specified name, display name, required/optinal indicator, and value.
StringParameter(java.lang.String name, java.lang.String displayName, java.lang.String description, boolean isRequired, java.lang.String value)
          Creates a new String parameter with the specified name, display name, description, required/optional indicator, and value.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this parameter.
 java.lang.String getDisplayValue()
          Retrieves the value of this parameter in a form that can be displayed to the end user.
 java.lang.String getHTMLInputForm(java.lang.String prefix)
          Retrieves the text necessary to request the value of this Boolean parameter from an HTML form.
 java.lang.String getInvalidReason(java.lang.Object value)
          Retrieves the reason that the specified value is not valid.
 java.lang.String getStringValue()
          Retrieves the value of this parameter as a Java String.
 java.lang.Object getValue()
          Retrieves the value of this parameter as a Java String.
 java.lang.String getValueString()
          Retrieves a string representation of the value of this parameter.
 int getVisibleColumns()
          Retrieves the number of columns that should be visible in the HTML input form.
 boolean hasValue()
          Indicates whether this parameter has a value.
 void htmlInputFormToValue(java.lang.String[] values)
          Specifies the value of this parameter based on the provided text that would be returned from posting an HTML form.
 void setValue(java.lang.Object value)
          Specifies the value to use for this string parameter.
 void setValueFrom(Parameter parameter)
          Sets the value for this parameter from the information in the provided parameter.
 void setValueFromString(java.lang.String valueString)
          Specifies the value to use for this parameter from the provided String.
 void setVisibleColumns(int visibleColumns)
          Specifies the number of columns that should be visible in the HTML input form.
 
Methods inherited from class com.sun.slamd.parameter.Parameter
decode, encode, getDescription, getDisplayName, getHTMLDisplayValue, getHTMLPostValue, getInvalidReason, getName, isRequired, isValid, isValid, setDescription, setDisplayName, setName, setRequired, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringParameter

public StringParameter()
Creates a new instance of the Parameter to be used when decoding values transported over the network, and should not be used by jobs to create parameters. If any initialization is needed that will not be covered by calls to the setName, setDisplayName, setDescription, or setValueFromString, then it should be done here.


StringParameter

public StringParameter(java.lang.String name)
Creates a new String parameter with the specified name. The display name will be the same as the name, it will not have a description, it will not have a value, and it will not be required.

Parameters:
name - The name to use for this parameter.

StringParameter

public StringParameter(java.lang.String name,
                       java.lang.String value)
Creates a new String parameter with the specified name and value. The display name will be the same as the name, it will not have a description, and it will not be required.

Parameters:
name - The name to use for this parameter.
value - The value to use for this parameter.

StringParameter

public StringParameter(java.lang.String name,
                       boolean isRequired)
Creates a new String parameter with the specified name and required/optional indicator. The display name will be the same as the name, and it will not have a description or value.

Parameters:
name - The name to use for this parameter.
isRequired - Indicates whether this parameter is required to have a value.

StringParameter

public StringParameter(java.lang.String name,
                       boolean isRequired,
                       java.lang.String value)
Creates a new String parameter with the specified name, value, and required/optional indicator. The display name will be the same as the name and it will not have a description.

Parameters:
name - The name to use for this parameter.
isRequired - Indicates whether this parameter is required to have a value.
value - The value to use for this parameter.

StringParameter

public StringParameter(java.lang.String name,
                       java.lang.String displayName,
                       boolean isRequired,
                       java.lang.String value)
Creates a new String parameter with the specified name, display name, required/optinal indicator, and value. It will not have a description.

Parameters:
name - The name to use for this parameter.
displayName - The name to use for this parameter if it is to be displayed to the end user.
isRequired - Indicates whether this parameter is required to have a value.
value - The value to use for this parameter.

StringParameter

public StringParameter(java.lang.String name,
                       java.lang.String displayName,
                       java.lang.String description,
                       boolean isRequired,
                       java.lang.String value)
Creates a new String parameter with the specified name, display name, description, required/optional indicator, and value.

Parameters:
name - The name to use for this parameter.
displayName - The name to use for this parameter if it is to be displayed to the end user.
description - The description to use for this parameter.
isRequired - Indicates whether this parameter is required to have a value.
value - The value to use for this parameter.
Method Detail

getStringValue

public java.lang.String getStringValue()
Retrieves the value of this parameter as a Java String.

Returns:
The value of this parameter as a Java String.

setValueFromString

public void setValueFromString(java.lang.String valueString)
                        throws InvalidValueException
Specifies the value to use for this parameter from the provided String. Note that no validation is performed with this method.

Specified by:
setValueFromString in class Parameter
Parameters:
valueString - The string representation of the value to use for this parameter.
Throws:
InvalidValueException - If the provided value cannot be used to provide a value for this parameter.

getValue

public java.lang.Object getValue()
Retrieves the value of this parameter as a Java String.

Overrides:
getValue in class Parameter
Returns:
The value of this parameter as a Java String.

hasValue

public boolean hasValue()
Indicates whether this parameter has a value.

Overrides:
hasValue in class Parameter
Returns:
true if it does have a value, or false if it does not.

setValue

public void setValue(java.lang.Object value)
              throws InvalidValueException
Specifies the value to use for this string parameter. Only values of type string will be accepted.

Overrides:
setValue in class Parameter
Parameters:
value - The value to use for this string parameter.
Throws:
InvalidValueException - If the provided object is not a string, or it is a required parameter but no value was specified.

setValueFrom

public void setValueFrom(Parameter parameter)
Sets the value for this parameter from the information in the provided parameter. Note that the provided parameter must be of the same type as this parameter or no action will be taken.

Specified by:
setValueFrom in class Parameter
Parameters:
parameter - The parameter from which to take the value for this parameter.

getValueString

public java.lang.String getValueString()
Retrieves a string representation of the value of this parameter.

Specified by:
getValueString in class Parameter
Returns:
A string representation of the value of this parameter.

getInvalidReason

public java.lang.String getInvalidReason(java.lang.Object value)
Retrieves the reason that the specified value is not valid.

Specified by:
getInvalidReason in class Parameter
Parameters:
value - The value for which to make the determination.
Returns:
The reason that the specified value is not valid, or null if it is valid.

getDisplayValue

public java.lang.String getDisplayValue()
Retrieves the value of this parameter in a form that can be displayed to the end user.

Specified by:
getDisplayValue in class Parameter
Returns:
The value of this parameter in a form that can be displayed to the end user.

getVisibleColumns

public int getVisibleColumns()
Retrieves the number of columns that should be visible in the HTML input form.

Returns:
The number of columns that should be visible in the HTML input form.

setVisibleColumns

public void setVisibleColumns(int visibleColumns)
Specifies the number of columns that should be visible in the HTML input form.

Parameters:
visibleColumns - The number of columns that should be visible in the HTML input form.

getHTMLInputForm

public java.lang.String getHTMLInputForm(java.lang.String prefix)
Retrieves the text necessary to request the value of this Boolean parameter from an HTML form.

Specified by:
getHTMLInputForm in class Parameter
Parameters:
prefix - The prefix that should be placed in front of the parameter name as the name of the form element.
Returns:
The text necessary to request the value of this Boolean parameter from an HTML form.

htmlInputFormToValue

public void htmlInputFormToValue(java.lang.String[] values)
                          throws InvalidValueException
Specifies the value of this parameter based on the provided text that would be returned from posting an HTML form.

Specified by:
htmlInputFormToValue in class Parameter
Parameters:
values - The set of values for this parameter contained in the servlet request.
Throws:
InvalidValueException - If the specified value is not acceptable for this parameter.

clone

public java.lang.Object clone()
Creates a clone of this parameter.

Specified by:
clone in class Parameter
Returns:
A clone of this parameter.