Package org.apache.commons.lang3.time
Class DurationFormatUtils.Token
java.lang.Object
org.apache.commons.lang3.time.DurationFormatUtils.Token
- Enclosing class:
DurationFormatUtils
Element that is parsed from the format pattern.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final DurationFormatUtils.Token[]
Empty array.private int
private final CharSequence
-
Constructor Summary
ConstructorsConstructorDescriptionToken
(CharSequence value, boolean optional, int optionalIndex) Wraps a token around a value. -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
containsTokenWithValue
(DurationFormatUtils.Token[] tokens, Object value) Helper method to determine if a set of tokens contain a valueboolean
Supports equality of this Token to another Token.(package private) int
getCount()
Gets the current number of values represented(package private) Object
getValue()
Gets the particular value this token represents.int
hashCode()
Returns a hash code for the token equal to the hash code for the token's value.(package private) void
Adds another one of the valuetoString()
Represents this token as a String.
-
Field Details
-
EMPTY_ARRAY
Empty array. -
value
-
count
private int count -
optionalIndex
private int optionalIndex
-
-
Constructor Details
-
Token
Token(CharSequence value, boolean optional, int optionalIndex) Wraps a token around a value. A value would be something like a 'Y'.- Parameters:
value
- value to wrap, non-null.optional
- whether the token is optionaloptionalIndex
- the index of the optional token within the pattern
-
-
Method Details
-
containsTokenWithValue
Helper method to determine if a set of tokens contain a value- Parameters:
tokens
- set to look invalue
- to look for- Returns:
- boolean
true
if contained
-
equals
Supports equality of this Token to another Token. -
getCount
int getCount()Gets the current number of values represented- Returns:
- int number of values represented
-
getValue
Object getValue()Gets the particular value this token represents.- Returns:
- Object value, non-null.
-
hashCode
public int hashCode()Returns a hash code for the token equal to the hash code for the token's value. Thus 'TT' and 'TTTT' will have the same hash code. -
increment
void increment()Adds another one of the value -
toString
Represents this token as a String.
-