Class DurationFormatUtils.Token

java.lang.Object
org.apache.commons.lang3.time.DurationFormatUtils.Token
Enclosing class:
DurationFormatUtils

static class DurationFormatUtils.Token extends Object
Element that is parsed from the format pattern.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private static final DurationFormatUtils.Token[]
    Empty array.
    private final Object
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Token(Object value)
    Wraps a token around a value.
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    Helper method to determine if a set of tokens contain a value
    boolean
    equals(Object obj2)
    Supports equality of this Token to another Token.
    (package private) int
    Gets the current number of values represented
    (package private) Object
    Gets the particular value this token represents.
    int
    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 value
    Represents this token as a String.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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 wrap
      count - to wrap
  • Method Details

    • containsTokenWithValue

      static boolean containsTokenWithValue(DurationFormatUtils.Token[] tokens, Object value)
      Helper method to determine if a set of tokens contain a value
      Parameters:
      tokens - set to look in
      value - to look for
      Returns:
      boolean true if 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

      public boolean equals(Object obj2)
      Supports equality of this Token to another Token.
      Overrides:
      equals in class Object
      Parameters:
      obj2 - Object to consider equality of
      Returns:
      boolean true if 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:
      hashCode in class Object
      Returns:
      The hash code for the token
    • toString

      public String toString()
      Represents this token as a String.
      Overrides:
      toString in class Object
      Returns:
      String representation of the token