< prev index next >

modules/javafx.base/src/main/java/javafx/util/converter/LocalTimeStringConverter.java

Print this page




  77      * @param timeStyle The {@link FormatStyle} that will be used by the default
  78      * formatter and parser. If null then {@link FormatStyle#SHORT} will be used.
  79      * @param locale The {@link Locale} that will be used by the default
  80      * formatter and parser. If null then
  81      * {@code Locale.getDefault(Locale.Category.FORMAT)} will be used.
  82      */
  83     public LocalTimeStringConverter(FormatStyle timeStyle, Locale locale) {
  84         ldtConverter = new LdtConverter<LocalTime>(LocalTime.class, null, null,
  85                                                   null, timeStyle, locale, null);
  86     }
  87 
  88     /**
  89      * Create a StringConverter for {@link LocalTime} values using the
  90      * supplied formatter and parser, which are responsible for
  91      * choosing the desired {@link Locale}.
  92      *
  93      * <p>For example, a fixed pattern can be used for converting both ways:</p>
  94      * <blockquote><pre>
  95      * String pattern = "HH:mm:ss";
  96      * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
  97      * StringConverter<LocalTime> converter =
  98      *     DateTimeStringConverter.getLocalTimeConverter(formatter, null);
  99      * </pre></blockquote>
 100      *
 101      * @param formatter An instance of {@link DateTimeFormatter} which
 102      * will be used for formatting by the toString() method. If null
 103      * then a default formatter will be used.
 104      * @param parser An instance of {@link DateTimeFormatter} which
 105      * will be used for parsing by the fromString() method. This can
 106      * be identical to formatter. If null, then formatter will be
 107      * used, and if that is also null, then a default parser will be
 108      * used.
 109      */
 110     public LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser) {
 111         ldtConverter = new LdtConverter<LocalTime>(LocalTime.class, formatter, parser,
 112                                                    null, null, null, null);
 113     }
 114 
 115     // ------------------------------------------------------- Converter Methods
 116 
 117     /** {@inheritDoc} */


  77      * @param timeStyle The {@link FormatStyle} that will be used by the default
  78      * formatter and parser. If null then {@link FormatStyle#SHORT} will be used.
  79      * @param locale The {@link Locale} that will be used by the default
  80      * formatter and parser. If null then
  81      * {@code Locale.getDefault(Locale.Category.FORMAT)} will be used.
  82      */
  83     public LocalTimeStringConverter(FormatStyle timeStyle, Locale locale) {
  84         ldtConverter = new LdtConverter<LocalTime>(LocalTime.class, null, null,
  85                                                   null, timeStyle, locale, null);
  86     }
  87 
  88     /**
  89      * Create a StringConverter for {@link LocalTime} values using the
  90      * supplied formatter and parser, which are responsible for
  91      * choosing the desired {@link Locale}.
  92      *
  93      * <p>For example, a fixed pattern can be used for converting both ways:</p>
  94      * <blockquote><pre>
  95      * String pattern = "HH:mm:ss";
  96      * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
  97      * StringConverter&lt;LocalTime&gt; converter =
  98      *     DateTimeStringConverter.getLocalTimeConverter(formatter, null);
  99      * </pre></blockquote>
 100      *
 101      * @param formatter An instance of {@link DateTimeFormatter} which
 102      * will be used for formatting by the toString() method. If null
 103      * then a default formatter will be used.
 104      * @param parser An instance of {@link DateTimeFormatter} which
 105      * will be used for parsing by the fromString() method. This can
 106      * be identical to formatter. If null, then formatter will be
 107      * used, and if that is also null, then a default parser will be
 108      * used.
 109      */
 110     public LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser) {
 111         ldtConverter = new LdtConverter<LocalTime>(LocalTime.class, formatter, parser,
 112                                                    null, null, null, null);
 113     }
 114 
 115     // ------------------------------------------------------- Converter Methods
 116 
 117     /** {@inheritDoc} */
< prev index next >