ICU-23032 Update MeasureUnit documentation for forIdentifier method

See #3360
This commit is contained in:
Younies Mahmoud 2025-01-31 09:48:51 +00:00
parent 697f7c0e00
commit 362a4aa94b
2 changed files with 21 additions and 13 deletions

View file

@ -426,16 +426,19 @@ class U_I18N_API MeasureUnit: public UObject {
MeasureUnit(MeasureUnit &&other) noexcept;
/**
* Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS
* 35. (Core unit identifiers and mixed unit identifiers are supported, long
* unit identifiers are not.) Validates and canonicalizes the identifier.
* Constructs a MeasureUnit from a CLDR Core Unit Identifier, as defined in UTS 35.
* This method supports core unit identifiers and mixed unit identifiers.
* It validates and canonicalizes the given identifier.
*
*
* Example usage:
* <pre>
* MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
* MeasureUnit example = MeasureUnit::forIdentifier("meter-per-second", status);
* </pre>
*
* @param identifier The CLDR Unit Identifier.
* @param status Set if the identifier is invalid.
* @param identifier the CLDR Unit Identifier
* @param status Set error if the identifier is invalid.
* @return the corresponding MeasureUnit
* @stable ICU 67
*/
static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);

View file

@ -411,18 +411,23 @@ public class MeasureUnit implements Serializable {
}
/**
* Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS
* 35. (Core unit identifiers and mixed unit identifiers are supported, long
* unit identifiers are not.) Validates and canonicalizes the identifier.
* Constructs a MeasureUnit from a CLDR Core Unit Identifier, as defined in UTS
* 35.
* This method supports core unit identifiers and mixed unit identifiers.
* It validates and canonicalizes the given identifier.
*
* Note: dimensionless <code>MeasureUnit</code> is <code>null</code>
* Note: A dimensionless <code>MeasureUnit</code> is represented as
* <code>null</code>.
*
* Example usage:
*
* <pre>
* MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
* MeasureUnit example = MeasureUnit.forIdentifier("meter-per-second);
* </pre>
*
* @param identifier CLDR Unit Identifier
* @throws IllegalArgumentException if the identifier is invalid.
* @param identifier the CLDR Unit Identifier
* @return the corresponding MeasureUnit
* @throws IllegalArgumentException if the identifier is invalid
* @stable ICU 68
*/
public static MeasureUnit forIdentifier(String identifier) {