Class Bindings<V,B extends Binding<V,B>>

java.lang.Object
org.microbean.qualifier.Bindings<V,B>
Type Parameters:
V - the type of a Binding's attribute values
B - The concrete subtype of this class
All Implemented Interfaces:
Constable, Iterable<B>
Direct Known Subclasses:
Qualifiers

public abstract class Bindings<V,B extends Binding<V,B>> extends Object implements Constable, Iterable<B>
An abstract, immutable iterable collection of Binding instances.
Author:
Laird Nelson
  • Constructor Details

  • Method Details

    • isEmpty

      public final boolean isEmpty()
      Returns true if this Bindings is logically empty.
      Returns:
      true if this Bindings is logically empty
      See Also:
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • size

      public final int size()
      Returns 0 or a positive integer describing the number of entries contained by this Bindings.
      Returns:
      the size of this Bindings
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • uniqueValue

      public final V uniqueValue(String name)
      Returns the sole Binding value whose name is equal to the supplied name, or null if either there is no such Binding or there are several Bindings with the supplied name.
      Parameters:
      name - the name; may be null in which case false will be returned
      Returns:
      the sole Binding value whose name is equal to the supplied name, or null if either there is no such Binding or there are several Bindings with the supplied name.
      See Also:
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method may return null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • unique

      public final B unique(String name)
      Returns the sole Binding instance whose name is equal to the supplied name, or null if either there is no such Binding or there are several Bindings with the supplied name.
      Parameters:
      name - the name; may be null in which case false will be returned
      Returns:
      the sole Binding instance whose name is equal to the supplied name, or null if either there is no such Binding or there are several Bindings with the supplied name.
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method may return null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • contains

      public final boolean contains(Object o)
      Returns true if and only if the supplied Object is contained by this Bindings.

      If the Object is a Binding, the containment check is performed via an equality check. If the Object is a String, then this method will return true if there is a Binding contained by this Bindings whose name is equal to the supplied String.

      There may be many Binding instances contained by this Bindings whose names are equal.

      Parameters:
      o - the Object to test; true return values are possible only when this Object is either a Binding or a String
      Returns:
      true if and only if the supplied Object is contained by this Bindings
      See Also:
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • containsUnique

      public final boolean containsUnique(String name)
      Returns true if and only if there is exactly one Binding contained by this Bindings whose name is equal to the supplied name.
      Parameters:
      name - the name to test; may be null in which case false will be returned
      Returns:
      true if and only if there is exactly one Binding contained by this Bindings whose name is equal to the supplied name
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • stream

      public final Stream<B> stream()
      Returns a Stream of this Bindings' entries.
      Returns:
      a Stream of this Bindings' entries
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • iterator

      public final Iterator<B> iterator()
      Returns a non-null, immutable Iterator of Binding instances contained by this Bindings.
      Specified by:
      iterator in interface Iterable<V>
      Returns:
      a non-null, immutable Iterator of Binding instances contained by this Bindings
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • spliterator

      public final Spliterator<B> spliterator()
      Returns a non-null, immutable Spliterator of Binding instances contained by this Bindings.
      Specified by:
      spliterator in interface Iterable<V>
      Returns:
      a non-null, immutable Spliterator of Binding instances contained by this Bindings
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • intersectionSize

      public final int intersectionSize(Iterable<?> other)
      Returns the number of entries this Bindings has in common with the supplied Iterable.

      The number returned will be 0 or greater.

      Parameters:
      other - the Iterable; may be null in which case 0 will be returned
      Returns:
      the number of entries this Bindings has in common with the supplied Iterable
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • symmetricDifferenceSize

      public final int symmetricDifferenceSize(Iterable<?> other)
      Returns the size of the symmetric difference between this Bindings and the supplied Iterable.

      The number returned is always 0 or greater.

      The size of the symmetric difference between this Bindings instance and the supplied Iterable is the number of entries that are in one of these two objects but not in the other.

      Parameters:
      other - an Iterable; may be null in which case the result of an invocation of this Bindings' size() method will be returned
      Returns:
      the size of the symmetric difference between this Bindings and the supplied Iterable; always 0 or greater
      Idempotency:
      This method is idempotent and deterministic.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • describeConstable

      public final Optional<? extends ConstantDesc> describeConstable()
      Returns an Optional housing a ConstantDesc describing this Bindings, if this Bindings is capable of being represented as a dynamic constant, or an empty Optional if not.
      Specified by:
      describeConstable in interface Constable
      Returns:
      an Optional housing a ConstantDesc describing this Binding, if this Bindings is capable of being represented as a dynamic constant, or an empty Optional if not
      See Also:
      Idempotency:
      This method is idempotent and deterministic.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads.
    • describeConstructor

      Returns a MethodHandleDesc describing the constructor or static method that will be used to create a dynamic constant representing this Bindings.
      Returns:
      a MethodHandleDesc describing the constructor or static method that will be used to create a dynamic constant representing this Bindings
      Idempotency:
      This method is, and its overrides must be, idempotent and deterministic.
      Nullability:
      This method does not, and its overrides must not, return null.
      Thread Safety:
      This method is, and its overrides must be, safe for concurrent use by multiple threads.
    • hashCode

      public final int hashCode()
      Returns a hashcode for this Bindings.
      Overrides:
      hashCode in class Object
      Returns:
      a hashcode for this Bindings
      See Also:
      Idempotency:
      This method is, and its overrides must be, idempotent and deterministic.
      Thread Safety:
      This method is, and its overrides must be, safe for concurrent use by multiple threads.
    • equals

      public final boolean equals(Object other)
      Returns true if and only if this Bindings is equal to the supplied Object.

      The supplied Object is considered to be equal to this Bindings if and only if:

      Overrides:
      equals in class Object
      Parameters:
      other - the Object to test; may be null in which case false will be returned
      Returns:
      true if the supplied Object is equal to this Binding
      See Also:
      Idempotency:
      This method is, and its overrides must be, idempotent and deterministic.
      Thread Safety:
      This method is, and its overrides must be, safe for concurrent use by multiple threads.
    • toString

      public String toString()
      Returns a String representation of this Bindings.

      The format of the returned String is deliberately undefined and may change between versions of this class without prior notice.

      Overrides:
      toString in class Object
      Returns:
      a String representation of this Bindings
      Idempotency:
      This method is, and its overrides must be, idempotent and deterministic.
      Nullability:
      This method does not, and its overrides must not, return null.
      Thread Safety:
      This method is, and its overrides must be, safe for concurrent use by multiple threads.