Record Class EnvironmentAttributeMap

java.lang.Object
java.lang.Record
dev.wyck.wrapper.environment.attribute.EnvironmentAttributeMap

@NullMarked @AsOf("2.1.0") public record EnvironmentAttributeMap(Map<ResourceKey, EnvironmentAttribute<?>> attributes, List<EnvironmentAttributeMap.Pending<?>> pending) extends Record
A collection of EnvironmentAttributes.
Since:
1.1.0
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • attributes

      @AsOf("2.1.0") public Map<ResourceKey, EnvironmentAttribute<?>> attributes()
      Returns the fully resolved attribute map.
      Returns:
      the resolved attributes, in an unmodifiable map
      Since:
      2.1.0
    • values

      @AsOf("2.1.0") public Collection<EnvironmentAttribute<?>> values()
      Returns the wrapped attributes as a collection. Order matches insertion order.
      Returns:
      the wrapped attributes
      Since:
      2.1.0
    • get

      @AsOf("3.0.0") public <V> @Nullable V get(EnvironmentAttributeSupplier<V> supplier)
      Returns the value of the given attribute, or null if it is not present. Pending values take precedence over resolved ones, and the most recently set pending value wins.
      Type Parameters:
      V - the type of the attribute
      Parameters:
      supplier - the attribute supplier
      Returns:
      the value associated with the supplier, or null if absent
      Since:
      3.0.0
    • empty

      @AsOf("1.1.0") public boolean empty()
      Returns:
      true if the map is empty, false otherwise.
      Since:
      1.1.0
    • toBuilder

      @AsOf("2.1.0") public EnvironmentAttributeMap.Builder toBuilder()
      Returns:
      a new builder pre-populated with this map's attributes.
      Since:
      2.1.0
    • with

      @AsOf("2.1.0") public <V> EnvironmentAttributeMap with(EnvironmentAttributeSupplier<V> supplier, @Nullable V value)
      Creates a new WrappedEnvironmentAttributeMap with the given attribute added.
      Type Parameters:
      V - the type of the attribute
      Parameters:
      supplier - the attribute supplier
      value - the value to set
      Returns:
      a new WrappedEnvironmentAttributeMap with the given attribute added
      Since:
      2.1.0
    • with

      @AsOf("2.1.0") public EnvironmentAttributeMap with(FriendlyColorSupplier supplier, @Nullable String hex)
      Creates a new WrappedEnvironmentAttributeMap with the given color attribute added.
      Parameters:
      supplier - the color attribute supplier
      hex - the hex value (e.g. "#FF10F0")
      Returns:
      a new WrappedEnvironmentAttributeMap with the given color attribute added
      Since:
      2.1.0
    • builder

      @AsOf("1.1.0") public static EnvironmentAttributeMap.Builder builder()
      Creates a new Builder instance.
      Returns:
      a new Builder instance
      Since:
      1.1.0
    • of

      @SafeVarargs @AsOf("2.1.0") public static <V> EnvironmentAttributeMap of(EnvironmentAttribute<V>... attributes)
      Creates a new WrappedEnvironmentAttributeMap from the given attributes.
      Parameters:
      attributes - the attributes to include
      Returns:
      a new WrappedEnvironmentAttributeMap
      Since:
      2.1.0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • pending

      public List<EnvironmentAttributeMap.Pending<?>> pending()
      Returns the value of the pending record component.
      Returns:
      the value of the pending record component