diff --git a/modules/javafx.base/src/main/java/javafx/util/converter/CurrencyStringConverter.java b/modules/javafx.base/src/main/java/javafx/util/converter/CurrencyStringConverter.java index fc47800e2ba..c1d45732c40 100644 --- a/modules/javafx.base/src/main/java/javafx/util/converter/CurrencyStringConverter.java +++ b/modules/javafx.base/src/main/java/javafx/util/converter/CurrencyStringConverter.java @@ -32,8 +32,7 @@ import javafx.util.StringConverter; /** - *

{@link StringConverter} implementation for {@link Number} values - * that represent currency.

+ * A {@link StringConverter} implementation for {@link Number} values that represent currency. Instances of this class are immutable. * * @see PercentageStringConverter * @see NumberStringConverter @@ -42,30 +41,54 @@ */ public class CurrencyStringConverter extends NumberStringConverter { - // ------------------------------------------------------------ Constructors + /** + * Constructs a {@code CurrencyStringConverter} with the default locale and format. + */ public CurrencyStringConverter() { this(Locale.getDefault()); } + /** + * Constructs a {@code CurrencyStringConverter} with the given locale and the default format. + * + * @param locale the locale used in determining the number format used to format the string + */ public CurrencyStringConverter(Locale locale) { this(locale, null); } + /** + * Constructs a {@code CurrencyStringConverter} with the default locale and the given decimal format pattern. + * + * @param pattern the string pattern used in determining the number format used to format the string + * + * @see java.text.DecimalFormat + */ public CurrencyStringConverter(String pattern) { this(Locale.getDefault(), pattern); } + /** + * Constructs a {@code CurrencyStringConverter} with the given locale and decimal format pattern. + * + * @param locale the locale used in determining the number format used to format the string + * @param pattern the string pattern used in determining the number format used to format the string + * + * @see java.text.DecimalFormat + */ public CurrencyStringConverter(Locale locale, String pattern) { super(locale, pattern, null); } + /** + * Constructs a {@code CurrencyStringConverter} with the given number format. + * + * @param numberFormat the number format used to format the string + */ public CurrencyStringConverter(NumberFormat numberFormat) { super(null, null, numberFormat); } - - // ---------------------------------------------------------------0- Methods - /** {@inheritDoc} */ @Override protected NumberFormat getNumberFormat() { Locale _locale = locale == null ? Locale.getDefault() : locale; diff --git a/modules/javafx.base/src/main/java/javafx/util/converter/NumberStringConverter.java b/modules/javafx.base/src/main/java/javafx/util/converter/NumberStringConverter.java index 4d1ed3e2deb..4fe91445817 100644 --- a/modules/javafx.base/src/main/java/javafx/util/converter/NumberStringConverter.java +++ b/modules/javafx.base/src/main/java/javafx/util/converter/NumberStringConverter.java @@ -33,34 +33,60 @@ import javafx.util.StringConverter; /** - *

{@link StringConverter} implementation for {@link Number} values.

+ * A {@link StringConverter} implementation for {@link Number} values. Instances of this class are immutable. + * * @since JavaFX 2.1 */ public class NumberStringConverter extends StringConverter { - // ------------------------------------------------------ Private properties - final Locale locale; final String pattern; final NumberFormat numberFormat; - // ------------------------------------------------------------ Constructors + /** + * Constructs a {@code NumberStringConverter} with the default locale and format. + */ public NumberStringConverter() { this(Locale.getDefault()); } + /** + * Constructs a {@code NumberStringConverter} with the given locale and the default format. + * + * @param locale the locale used in determining the number format used to format the string + */ public NumberStringConverter(Locale locale) { this(locale, null); } + /** + * Constructs a {@code NumberStringConverter} with the default locale and the given decimal format pattern. + * + * @param pattern the string pattern used in determining the number format used to format the string + * + * @see java.text.DecimalFormat + */ public NumberStringConverter(String pattern) { this(Locale.getDefault(), pattern); } + /** + * Constructs a {@code NumberStringConverter} with the given locale and decimal format pattern. + * + * @param locale the locale used in determining the number format used to format the string + * @param pattern the string pattern used in determining the number format used to format the string + * + * @see java.text.DecimalFormat + */ public NumberStringConverter(Locale locale, String pattern) { this(locale, pattern, null); } + /** + * Constructs a {@code NumberStringConverter} with the given number format. + * + * @param numberFormat the number format used to format the string + */ public NumberStringConverter(NumberFormat numberFormat) { this(null, null, numberFormat); } @@ -71,8 +97,6 @@ public NumberStringConverter(NumberFormat numberFormat) { this.numberFormat = numberFormat; } - // ------------------------------------------------------- Converter Methods - /** {@inheritDoc} */ @Override public Number fromString(String value) { try { @@ -112,11 +136,11 @@ public NumberStringConverter(NumberFormat numberFormat) { } /** - *

Return a NumberFormat instance to use for formatting - * and parsing in this {@link StringConverter}.

+ * Returns a {@code NumberFormat} instance to use for formatting + * and parsing in this {@code StringConverter}. * * @return a {@code NumberFormat} instance for formatting and parsing in this - * {@link StringConverter} + * {@code StringConverter} */ protected NumberFormat getNumberFormat() { Locale _locale = locale == null ? Locale.getDefault() : locale; diff --git a/modules/javafx.base/src/main/java/javafx/util/converter/PercentageStringConverter.java b/modules/javafx.base/src/main/java/javafx/util/converter/PercentageStringConverter.java index ae16890b66e..d8987f42e38 100644 --- a/modules/javafx.base/src/main/java/javafx/util/converter/PercentageStringConverter.java +++ b/modules/javafx.base/src/main/java/javafx/util/converter/PercentageStringConverter.java @@ -30,8 +30,8 @@ import javafx.util.StringConverter; /** - *

{@link StringConverter} implementation for {@link Number} values - * that represent percentages.

+ * A {@link StringConverter} implementation for {@link Number} values that represent percentages. Instances of this class are + * immutable. * * @see CurrencyStringConverter * @see NumberStringConverter @@ -40,22 +40,31 @@ */ public class PercentageStringConverter extends NumberStringConverter { - - // ------------------------------------------------------------ Constructors + /** + * Constructs a {@code PercentageStringConverter} with the default locale and format. + */ public PercentageStringConverter() { this(Locale.getDefault()); } + /** + * Constructs a {@code PercentageStringConverter} with the given locale and the default format. + * + * @param locale the locale used in determining the number format used to format the string + */ public PercentageStringConverter(Locale locale) { super(locale, null, null); } + /** + * Constructs a {@code PercentageStringConverter} with the given number format. + * + * @param numberFormat the number format used to format the string + */ public PercentageStringConverter(NumberFormat numberFormat) { super(null, null, numberFormat); } - // ----------------------------------------------------------------- Methods - /** {@inheritDoc} */ @Override public NumberFormat getNumberFormat() { Locale _locale = locale == null ? Locale.getDefault() : locale;