Class FormatStringConverter<T>
java.lang.Object
javafx.util.StringConverter<T>
javafx.util.converter.FormatStringConverter<T>
- Type Parameters:
T- the type converted to/from a string
A
StringConverter implementation that can use a Format instance to convert arbitrary types to and from a string.
Instances of this class are only immutable if the used Format is immutable.- Since:
- JavaFX 2.2
-
Constructor Summary
ConstructorsConstructorDescriptionFormatStringConverter(Format format) Creates aFormatStringConverterfor arbitrary types that uses the givenFormat. -
Method Summary
-
Constructor Details
-
FormatStringConverter
Creates aFormatStringConverterfor arbitrary types that uses the givenFormat.- Parameters:
format- the formatter/parser that will be used by thetoString()andfromString()methods. Must not benull.
-
-
Method Details
-
getFormat
Returns theFormatinstance for formatting and parsing in thisFormatStringConverter.- Returns:
- the
Formatinstance for formatting and parsing in thisFormatStringConverter
-
fromString
Converts a string to an object. The parsing mechanism is defined by the specific converter.nulland empty string are converted tonull.- Specified by:
fromStringin classStringConverter<T>- Parameters:
string- theStringto convert- Returns:
- an object of type
Tcreated from the string passed in
-
toString
Converts an object to a string form. The format of the returned string is defined by the specific converter.nullis converted to an empty string, otherwise the type'stoStringis used.- Specified by:
toStringin classStringConverter<T>- Parameters:
object- the object of typeTto convert- Returns:
- a string representation of the object passed in
-