Package com.ibm.icu.impl
Class FormattedValueStringBuilderImpl
- java.lang.Object
-
- com.ibm.icu.impl.FormattedValueStringBuilderImpl
-
public class FormattedValueStringBuilderImpl extends java.lang.Object
Implementation of FormattedValue based on FormattedStringBuilder. The implementation currently revolves around numbers and number fields. However, it can be generalized in the future when there is a need. In C++, this implements FormattedValue. In Java, it is a stateless collection of static functions to avoid having to use nested objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
FormattedValueStringBuilderImpl.NullField
static class
FormattedValueStringBuilderImpl.SpanFieldPlaceholder
Placeholder field used for calculating spans.
-
Constructor Summary
Constructors Constructor Description FormattedValueStringBuilderImpl()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
applySpanRange(FormattedStringBuilder self, UFormat.SpanField spanField, java.lang.Object value, int start, int end)
Upgrade a range of a string to a span field.static int
findSpan(FormattedStringBuilder self, java.lang.Object value)
Finds the index at which a span field begins.private static boolean
isIntOrGroup(java.lang.Object field)
private static boolean
isNumericField(java.lang.Object field)
private static boolean
isTrimmable(java.lang.Object field)
static boolean
nextFieldPosition(FormattedStringBuilder self, java.text.FieldPosition fp)
static boolean
nextPosition(FormattedStringBuilder self, ConstrainedFieldPosition cfpos, java.text.Format.Field numericField)
Implementation of nextPosition consistent with the contract of FormattedValue.static java.text.AttributedCharacterIterator
toCharacterIterator(FormattedStringBuilder self, java.text.Format.Field numericField)
private static int
trimBack(FormattedStringBuilder self, int limit)
private static int
trimFront(FormattedStringBuilder self, int start)
-
-
-
Method Detail
-
findSpan
public static int findSpan(FormattedStringBuilder self, java.lang.Object value)
Finds the index at which a span field begins.- Parameters:
value
- The value of the span field to search for.- Returns:
- The index, or -1 if not found.
-
applySpanRange
public static void applySpanRange(FormattedStringBuilder self, UFormat.SpanField spanField, java.lang.Object value, int start, int end)
Upgrade a range of a string to a span field. Similar to appendSpanInfo in ICU4C.
-
nextFieldPosition
public static boolean nextFieldPosition(FormattedStringBuilder self, java.text.FieldPosition fp)
-
toCharacterIterator
public static java.text.AttributedCharacterIterator toCharacterIterator(FormattedStringBuilder self, java.text.Format.Field numericField)
-
nextPosition
public static boolean nextPosition(FormattedStringBuilder self, ConstrainedFieldPosition cfpos, java.text.Format.Field numericField)
Implementation of nextPosition consistent with the contract of FormattedValue.- Parameters:
cfpos
- The argument passed to the public API.numericField
- Optional. If non-null, apply this field to the entire numeric portion of the string.- Returns:
- See FormattedValue#nextPosition.
-
isIntOrGroup
private static boolean isIntOrGroup(java.lang.Object field)
-
isNumericField
private static boolean isNumericField(java.lang.Object field)
-
isTrimmable
private static boolean isTrimmable(java.lang.Object field)
-
trimBack
private static int trimBack(FormattedStringBuilder self, int limit)
-
trimFront
private static int trimFront(FormattedStringBuilder self, int start)
-
-