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 intprivate static final DurationFormatUtils.Token[]Empty array.private final Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static booleancontainsTokenWithValue(DurationFormatUtils.Token[] tokens, Object value) Helper method to determine if a set of tokens contain a valuebooleanSupports equality of this Token to another Token.(package private) intgetCount()Gets the current number of values represented(package private) ObjectgetValue()Gets the particular value this token represents.inthashCode()Returns a hash code for the token equal to the hash code for the token's value.(package private) voidAdds another one of the valuetoString()Represents this token as a String.
-
Field Details
-
EMPTY_ARRAY
Empty array. -
value
-
count
private int count
-
-
Constructor Details
-
Token
Token(Object value) Wraps a token around a value. A value would be something like a 'Y'.- Parameters:
value- to wrap
-
Token
Token(Object value, int count) Wraps a token around a repeated number of a value, for example it would store 'yyyy' as a value for y and a count of 4.- Parameters:
value- to wrapcount- to wrap
-
-
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
trueif contained
-
increment
void increment()Adds another one of the value -
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
-
equals
Supports equality of this Token to another Token. -
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. -
toString
Represents this token as a String.
-