Class ExplainMap

  • All Implemented Interfaces:
    java.io.Serializable, Bean, ImmutableBean

    public final class ExplainMap
    extends java.lang.Object
    implements ImmutableBean, java.io.Serializable
    A map of explanatory values.

    This is a loosely defined data structure that allows an explanation of a calculation to be represented.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static ExplainMap of​(java.util.Map<ExplainKey<?>,​java.lang.Object> map)
        Creates an instance from a populated map.
        Parameters:
        map - the map
        Returns:
        the explanatory map
      • builder

        public static ExplainMapBuilder builder()
        Returns a builder for creating the map.
        Returns:
        the builder
      • get

        public <R> java.util.Optional<R> get​(ExplainKey<R> key)
        Gets a value by key.
        Type Parameters:
        R - the type of the key
        Parameters:
        key - the key to lookup
        Returns:
        the value associated with the key
      • explanationString

        public java.lang.String explanationString()
        Gets the explanation as a string.

        This returns a multi-line string containing the string form of the entries.

        Returns:
        the explanation as a string
      • meta

        public static ExplainMap.Meta meta()
        The meta-bean for ExplainMap.
        Returns:
        the meta-bean, not null
      • getMap

        public com.google.common.collect.ImmutableMap<ExplainKey<?>,​java.lang.Object> getMap()
        Gets the map of explanatory values.
        Returns:
        the value of the property, not null
      • equals

        public boolean equals​(java.lang.Object obj)
        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