Class DimensionValues

  • All Implemented Interfaces:
    java.lang.Comparable<DimensionValues>

    public class DimensionValues
    extends java.lang.Object
    implements java.lang.Comparable<DimensionValues>
    An immutable set of dimension values. Note that this may contain more or fewer values than needed given a set of dimensions. Any missing values are treated as null.
    Author:
    bratseth
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> asContext​(java.util.List<java.lang.String> dimensions)  
      int compareTo​(DimensionValues other)
      Implements the sort order of this which is based on specificity where dimensions to the left are more significant: -1 is returned if this is more specific than other, 1 is returned if other is more specific than this, 0 is returned if none is more specific than the other.
      static DimensionValues createFrom​(java.lang.String[] values)  
      boolean equals​(java.lang.Object o)  
      java.lang.String get​(int index)
      Returns the string at the given index, or null if it has no value at this index
      java.lang.String[] getValues()
      Returns a copy of the values in this in an array
      int hashCode()  
      boolean isEmpty()  
      boolean isMoreSpecificThan​(DimensionValues other)
      Helper method which uses compareTo to return whether this is most specific
      boolean matches​(DimensionValues givenValues)
      Returns true if this is has the same value every place it has a value as the givenValues.
      int size()
      Returns the number of values in this (some of which may be null)
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • createFrom

        public static DimensionValues createFrom​(java.lang.String[] values)
      • matches

        public boolean matches​(DimensionValues givenValues)
        Returns true if this is has the same value every place it has a value as the givenValues.
      • compareTo

        public int compareTo​(DimensionValues other)
        Implements the sort order of this which is based on specificity where dimensions to the left are more significant: -1 is returned if this is more specific than other, 1 is returned if other is more specific than this, 0 is returned if none is more specific than the other.

        Note: This ordering is not consistent with equals - it returns 0 when the same dimensions are set, regardless of what they are set to.

        Specified by:
        compareTo in interface java.lang.Comparable<DimensionValues>
      • isMoreSpecificThan

        public boolean isMoreSpecificThan​(DimensionValues other)
        Helper method which uses compareTo to return whether this is most specific
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isEmpty

        public boolean isEmpty()
      • asContext

        public java.util.Map<java.lang.String,​java.lang.String> asContext​(java.util.List<java.lang.String> dimensions)
      • get

        public java.lang.String get​(int index)
        Returns the string at the given index, or null if it has no value at this index
      • size

        public int size()
        Returns the number of values in this (some of which may be null)
      • getValues

        public java.lang.String[] getValues()
        Returns a copy of the values in this in an array