Class AttributeMultiMap

java.lang.Object
com.mayam.wf.attributes.shared.AttributeMultiMap
All Implemented Interfaces:
Serializable

public class AttributeMultiMap extends Object implements Serializable
Map from Attribute to a set of values and a flag indicating inclusive or exclusive use. When properly injected, the map will validate input to make sure it conforms to Attribute annotations.
Author:
Markus MÃ¥rtensson
See Also:
  • Field Details

  • Constructor Details

    • AttributeMultiMap

      public AttributeMultiMap()
  • Method Details

    • injectHelpers

      @Inject public void injectHelpers(AttributeValidator validator)
      Injects helper objects. Generally called by injector during creation, later using Injector.injectMembers() or manually by an object having access to both instances. A missing validator will cause the map to silently accept all input whereas
      Parameters:
      validator - AttributeValidator instance.
    • hasInjectedHelpers

      public boolean hasInjectedHelpers()
      Checks for the existence of AttributeValidator helper instance.
      Returns:
      true if the helper is injected.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getAttributeValues

      public <T> Set<T> getAttributeValues(Attribute attribute)
    • getAttributeValues

      public <T> Set<T> getAttributeValues(Attribute attribute, Class<T> cls)
    • getAttributeInclusivity

      public AttributeMultiMap.Inclusivity getAttributeInclusivity(Attribute attribute)
    • addAsInclusion

      public void addAsInclusion(Attribute attribute, Object value)
    • addAsExclusion

      public void addAsExclusion(Attribute attribute, Object value)
    • addAsInclusions

      public void addAsInclusions(Attribute attribute, Collection<? extends Object> values)
    • addAsExclusions

      public void addAsExclusions(Attribute attribute, Collection<? extends Object> values)
    • addAsInclusions

      public void addAsInclusions(Attribute attribute, Object... values)
    • addAsExclusions

      public void addAsExclusions(Attribute attribute, Object... values)
    • putAll

      public void putAll(AttributeMultiMap other)
    • remove

      public void remove(Attribute attribute)
    • clear

      public void clear()
      Removes all values from the values.
    • containsAttribute

      public boolean containsAttribute(Attribute attribute)
    • getAttributeSet

      public Set<Attribute> getAttributeSet()
    • copy

      public AttributeMultiMap copy()
      Creates a full copy of the values. Dirty values are included, but the resulting map will have no dirty flags set.
      Returns:
      new values.
    • copy

      public AttributeMultiMap copy(Collection<Attribute> attributes)
      Creates a partial copy of the map, including only the provided collection of attributes. Dirty values are included, but the resulting map will have no dirty flags set.
      Returns:
      new values.
    • merge

      public static AttributeMultiMap merge(AttributeMultiMap original, AttributeMultiMap overrides)
      Merges two AttributeRangeMap objects with priority given to the one referred to as "overrides". Expected to be called as "original = merge(original,overrides)". For this reason, original may become updated whereas overrides will not be touched.
      Parameters:
      original - original map, or null.
      overrides - map with overrides, or null.
      Returns:
      merged map, or null if both arguments were null.