Skip to content

Commit

Permalink
8250799: NumberStringConverter and its subclasses are missing documen…
Browse files Browse the repository at this point in the history
…tation for all their constructors

Reviewed-by: jvos, kcr
  • Loading branch information
nlisker committed Aug 10, 2020
1 parent 487854c commit 7a8708b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
import javafx.util.StringConverter;

/**
* <p>{@link StringConverter} implementation for {@link Number} values
* that represent currency.</p>
* A {@link StringConverter} implementation for {@link Number} values that represent currency. Instances of this class are immutable.
*
* @see PercentageStringConverter
* @see NumberStringConverter
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,60 @@
import javafx.util.StringConverter;

/**
* <p>{@link StringConverter} implementation for {@link Number} values.</p>
* A {@link StringConverter} implementation for {@link Number} values. Instances of this class are immutable.
*
* @since JavaFX 2.1
*/
public class NumberStringConverter extends StringConverter<Number> {

// ------------------------------------------------------ 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);
}
Expand All @@ -71,8 +97,6 @@ public NumberStringConverter(NumberFormat numberFormat) {
this.numberFormat = numberFormat;
}

// ------------------------------------------------------- Converter Methods

/** {@inheritDoc} */
@Override public Number fromString(String value) {
try {
Expand Down Expand Up @@ -112,11 +136,11 @@ public NumberStringConverter(NumberFormat numberFormat) {
}

/**
* <p>Return a <code>NumberFormat</code> instance to use for formatting
* and parsing in this {@link StringConverter}.</p>
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import javafx.util.StringConverter;

/**
* <p>{@link StringConverter} implementation for {@link Number} values
* that represent percentages.</p>
* A {@link StringConverter} implementation for {@link Number} values that represent percentages. Instances of this class are
* immutable.
*
* @see CurrencyStringConverter
* @see NumberStringConverter
Expand All @@ -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;
Expand Down

0 comments on commit 7a8708b

Please sign in to comment.