Package org.apache.guacamole.form
Class NumericField
- java.lang.Object
-
- org.apache.guacamole.form.Field
-
- org.apache.guacamole.form.NumericField
-
public class NumericField extends Field
Represents a field which may contain only integer values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.guacamole.form.Field
Field.Type
-
-
Constructor Summary
Constructors Constructor Description NumericField(String name)
Creates a new NumericField with the given name.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
format(Integer i)
Formats the given integer in the format required by a numeric field.static Integer
parse(String str)
Parses the given string as an integer, where the given string is in the format required by a numeric field.-
Methods inherited from class org.apache.guacamole.form.Field
getName, getOptions, getType, setName, setOptions, setType
-
-
-
-
Constructor Detail
-
NumericField
public NumericField(String name)
Creates a new NumericField with the given name.- Parameters:
name
- The unique name to associate with this field.
-
-
Method Detail
-
format
public static String format(Integer i)
Formats the given integer in the format required by a numeric field.- Parameters:
i
- The integer to format, which may be null.- Returns:
- A string representation of the given integer, or null if the given integer was null.
-
parse
public static Integer parse(String str) throws NumberFormatException
Parses the given string as an integer, where the given string is in the format required by a numeric field.- Parameters:
str
- The string to parse as an integer, which may be null.- Returns:
- The integer representation of the given string, or null if the given string was null.
- Throws:
NumberFormatException
- If the given string is not in a parseable format.
-
-