water.api
Class RequestArguments.EnumArgument<T extends java.lang.Enum<T>>

java.lang.Object
  extended by water.Iced
      extended by water.api.RequestArguments.Argument<T>
          extended by water.api.RequestArguments.InputSelect<T>
              extended by water.api.RequestArguments.EnumArgument<T>
All Implemented Interfaces:
java.lang.Cloneable, Request.Filter, Freezable
Direct Known Subclasses:
RequestArguments.CaseModeSelect
Enclosing class:
RequestArguments

public class RequestArguments.EnumArgument<T extends java.lang.Enum<T>>
extends RequestArguments.InputSelect<T>


Field Summary
protected  java.lang.Class<T> _enumClass
           
 
Fields inherited from class water.api.RequestArguments.Argument
_displayName, _field, _hideInQuery, _name, _prerequisites, _readOnly, _requestHelp, _required
 
Constructor Summary
RequestArguments.EnumArgument(java.lang.String name, java.lang.Class enumClass)
           
RequestArguments.EnumArgument(java.lang.String name, T defaultValue)
           
RequestArguments.EnumArgument(java.lang.String name, T defaultValue, boolean refreshOnChange)
           
RequestArguments.EnumArgument(T defaultValue)
           
 
Method Summary
protected  T defaultValue()
          Returns the default value of the argument.
protected  T parse(java.lang.String input)
          Override this method to provide parsing of the input string to the Java expected value.
protected  java.lang.String queryDescription()
          Returns the query description.
protected  java.lang.String selectedItemValue()
          Returns which value should be selected.
protected  java.lang.String[] selectValues()
          Override this method to provide the values for the options.
 
Methods inherited from class water.api.RequestArguments.InputSelect
jsRefresh, jsValue, queryElement, selectNames
 
Methods inherited from class water.api.RequestArguments.Argument
addPrerequisite, check, disable, disable, disabled, errors, jsAddons, originalValue, query, queryAddons, queryComment, record, refreshOnChange, requestHelp, reset, run, setRefreshOnChange, specified, valid, value
 
Methods inherited from class water.Iced
clone, frozenType, init, newInstance, read, toDocField, write, writeJSON, writeJSONFields
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_enumClass

protected final transient java.lang.Class<T extends java.lang.Enum<T>> _enumClass
Constructor Detail

RequestArguments.EnumArgument

public RequestArguments.EnumArgument(T defaultValue)

RequestArguments.EnumArgument

public RequestArguments.EnumArgument(java.lang.String name,
                                     T defaultValue,
                                     boolean refreshOnChange)

RequestArguments.EnumArgument

public RequestArguments.EnumArgument(java.lang.String name,
                                     T defaultValue)

RequestArguments.EnumArgument

public RequestArguments.EnumArgument(java.lang.String name,
                                     java.lang.Class enumClass)
Method Detail

selectValues

protected java.lang.String[] selectValues()
Description copied from class: RequestArguments.InputSelect
Override this method to provide the values for the options. These will be the possible values returned by the form's input and should be the possible values for the JSON argument.

Specified by:
selectValues in class RequestArguments.InputSelect<T extends java.lang.Enum<T>>

selectedItemValue

protected java.lang.String selectedItemValue()
Description copied from class: RequestArguments.InputSelect
Returns which value should be selected. This is *not* the default value itself, as the default values may be of any type, but the input value that should be selected in the browser.

Specified by:
selectedItemValue in class RequestArguments.InputSelect<T extends java.lang.Enum<T>>

parse

protected T parse(java.lang.String input)
                                     throws java.lang.IllegalArgumentException
Description copied from class: RequestArguments.Argument
Override this method to provide parsing of the input string to the Java expected value. The input is guaranteed to be non-empty when this method is called and all prerequisities are guaranteed to be valid before this method is called.

Specified by:
parse in class RequestArguments.Argument<T extends java.lang.Enum<T>>
Throws:
java.lang.IllegalArgumentException

defaultValue

protected T defaultValue()
Description copied from class: RequestArguments.Argument
Returns the default value of the argument. Note that the method will be called also on required arguments, in which case it is ok return null. It is kept abstract because defining a proper default value might be tricky and in many case you do not want it to be null. Overriding it always makes you think:)

Specified by:
defaultValue in class RequestArguments.Argument<T extends java.lang.Enum<T>>

queryDescription

protected java.lang.String queryDescription()
Description copied from class: RequestArguments.Argument
Returns the query description. This is a concise description of a correct value for the argument. generally used as a placeholder in the html query elements.

Specified by:
queryDescription in class RequestArguments.Argument<T extends java.lang.Enum<T>>