Package org.apache.guacamole.form
Class TimeField
- java.lang.Object
-
- org.apache.guacamole.form.Field
-
- org.apache.guacamole.form.TimeField
-
public class TimeField extends Field
Represents a time field. The field may contain only time values which conform to a standard pattern, defined by TimeField.FORMAT.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.guacamole.form.Field
Field.Type
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
format(Date time)
Converts the given time into a string which follows the format used by time fields.static Date
parse(String timeString)
Parses the given string into a corresponding time.-
Methods inherited from class org.apache.guacamole.form.Field
getName, getOptions, getType, setName, setOptions, setType
-
-
-
-
Field Detail
-
FORMAT
public static final String FORMAT
The time format used by time fields, compatible with SimpleDateFormat.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TimeField
public TimeField(String name)
Creates a new TimeField with the given name.- Parameters:
name
- The unique name to associate with this field.
-
-
Method Detail
-
parse
public static Date parse(String timeString) throws ParseException
Parses the given string into a corresponding time. The string must follow the standard format used by time fields, as defined by FORMAT and as would be produced by format().- Parameters:
timeString
- The time string to parse, which may be null.- Returns:
- The time corresponding to the given time string, or null if the provided time string was null or blank.
- Throws:
ParseException
- If the given time string does not conform to the standard format used by time fields.
-
-