Class DimensionBinding


  • public class DimensionBinding
    extends java.lang.Object
    An immutable, binding of a list of dimensions to dimension values
    Author:
    bratseth
    • Method Detail

      • createFrom

        public static DimensionBinding createFrom​(java.util.Map<java.lang.String,​java.lang.String> values)
      • createFrom

        public static DimensionBinding createFrom​(java.util.List<java.lang.String> dimensions,
                                                  java.util.Map<java.lang.String,​java.lang.String> context)
        Creates a binding from a variant and a context. Any of the arguments may be null.
      • createFrom

        public static DimensionBinding createFrom​(java.util.List<java.lang.String> dimensions,
                                                  DimensionValues dimensionValues)
        Creates a binding from a variant and a context. Any of the arguments may be null.
      • createFor

        public DimensionBinding createFor​(java.util.List<java.lang.String> newDimensions)
        Returns a binding for a (possibly) new set of variants. Variants may be null, but not bindings
      • getDimensions

        public java.util.List<java.lang.String> getDimensions()
        Returns a read-only list of the dimensions of this. This value is undefined if this isNull()
      • getContext

        public java.util.Map<java.lang.String,​java.lang.String> getContext()
        Returns a context created from the dimensions and values of this
      • getValues

        public DimensionValues getValues()
        Returns the values for the dimensions of this. This value is undefined if this isEmpty() This array is always of the same length as the length of the dimension list - missing elements are represented as nulls. This is never null but may be empty.
      • isNull

        public boolean isNull()
        Returns true only if this binding is null (contains no values for its dimensions (if any)
      • combineWith

        public DimensionBinding combineWith​(DimensionBinding other)
        Combines this binding with another if compatible. Two bindings are incompatible if
        • They contain a different value for the same key, or
        • They contain the same pair of dimensions in a different order
        Returns:
        the combined binding, or the special invalidBinding if these two bindings are incompatible
      • isInvalid

        public boolean isInvalid()
        Returns true if this == invalidBinding
      • toString

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

        public boolean equals​(java.lang.Object o)
        Two bindings are equal if they contain the same dimensions and the same non-null values
        Overrides:
        equals in class java.lang.Object
      • hashCode

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