Package org.apache.commons.lang3.time
Class DurationFormatUtils.Token
- java.lang.Object
-
- org.apache.commons.lang3.time.DurationFormatUtils.Token
-
- Enclosing class:
- DurationFormatUtils
static class DurationFormatUtils.Token extends java.lang.ObjectElement that is parsed from the format pattern.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleancontainsTokenWithValue(DurationFormatUtils.Token[] tokens, java.lang.Object value)Helper method to determine if a set of tokens contain a valuebooleanequals(java.lang.Object obj2)Supports equality of this Token to another Token.(package private) intgetCount()Gets the current number of values represented(package private) java.lang.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) voidincrement()Adds another one of the valuejava.lang.StringtoString()Represents this token as a String.
-
-
-
Constructor Detail
-
Token
Token(java.lang.Object value)
Wraps a token around a value. A value would be something like a 'Y'.- Parameters:
value- to wrap
-
Token
Token(java.lang.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 Detail
-
containsTokenWithValue
static boolean containsTokenWithValue(DurationFormatUtils.Token[] tokens, java.lang.Object value)
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
java.lang.Object getValue()
Gets the particular value this token represents.- Returns:
- Object value
-
equals
public boolean equals(java.lang.Object obj2)
Supports equality of this Token to another Token.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj2- Object to consider equality of- Returns:
- boolean
trueif equal
-
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.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code for the token
-
toString
public java.lang.String toString()
Represents this token as a String.- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation of the token
-
-