Class Qualifiers<V>

java.lang.Object
org.microbean.qualifier.Bindings<V,Qualifier<V>>
org.microbean.qualifier.Qualifiers<V>
Type Parameters:
V - the type of a Qualifier's attribute values
All Implemented Interfaces:
Constable, Iterable<Qualifier<V>>

public final class Qualifiers<V> extends Bindings<V,Qualifier<V>>
An immutable Bindings containing Qualifier instances.

This is a value-based class.

Author:
Laird Nelson
See Also:
  • Method Details

    • plus

      public final Qualifiers<V> plus(Qualifier<V> qualifier)
      Returns a usually new Qualifiers with this Qualifiers' entries and an additional entry consisting of the supplied Qualifier.

      The returned Qualifiers will be new unless qualifier is null, in which case this will be returned.

      Parameters:
      qualifier - a Qualifier; may be null in which case this will be returned
      Returns:
      a Qualifiers with this Qualifiers' entries and an additional entry consisting of the supplied Qualifier
      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.
    • plus

      public final Qualifiers<V> plus(Iterable<? extends Qualifier<V>> qualifiers)
      Returns a usually new Qualifiers with this Qualifiers' entries and additional entries represented by the supplied qualifiers.

      The returned Qualifiers will be new unless qualifier is null, in which case this will be returned.

      Parameters:
      qualifiers - additional Qualifiers; may be null in which case this will be returned
      Returns:
      a Qualifiers with this Qualifiers' entries and additional entries represented by the supplied qualifiers
      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.
    • withPrefix

      public final Qualifiers<V> withPrefix(String prefix)
      Returns a usually new Qualifiers whose Qualifiers' attribute keys are prefixed with the supplied prefix.

      If this Qualifiers is empty, then this is returned.

      Parameters:
      prefix - a prefix; if null then this will be returned
      Returns:
      a usually new Qualifiers whose Qualifiers' attribute keys are prefixed with the supplied prefix
      Idempotency:
      This method is idempotent and deterministic, assuming the supplied Function is.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads
    • withPrefix

      public final Qualifiers<V> withPrefix(Function<? super Qualifier<V>,? extends String> f)
      Returns a usually new Qualifiers whose Qualifiers' attribute keys are produced by the supplied Function, which is expected to prepend a prefix to the original key and return the result.

      If this Qualifiers is empty, then this is returned.

      Parameters:
      f - a deterministic, idempotent Function that accepts keys drawn from this Qualifiers' Qualifiers' attribute keys and returns a non-null prefixed version of that key; may be null in which case this will be returned
      Returns:
      a usually new Qualifiers whose Qualifiers' attribute keys have been prefixed by the actions of the supplied Function
      Idempotency:
      This method is idempotent and deterministic, assuming the supplied Function is.
      Nullability:
      This method never returns null.
      Thread Safety:
      This method is safe for concurrent use by multiple threads, assuming the supplied Function is
    • describeConstructor

      Returns a MethodHandleDesc describing the constructor or static method that will be used to create a dynamic constant representing this Qualifiers.
      Overrides:
      describeConstructor in class Bindings<V,Qualifier<V>>
      Returns:
      a MethodHandleDesc describing the constructor or static method that will be used to create a dynamic constant representing this Qualifiers
      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.
    • of

      public static final <V> Qualifiers<V> of()
      Returns a Qualifiers, which may or may not be newly created, whose isEmpty() method will return true.
      Type Parameters:
      V - the type of the Qualifier's attribute values
      Returns:
      a Qualifiers
      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.
    • of

      public static final <V> Qualifiers<V> of(Qualifier<V> qualifier)
      Returns a Qualifiers, which may or may not be newly created, representing the supplied arguments.
      Type Parameters:
      V - the type of the Qualifier's attribute values
      Parameters:
      qualifier - the sole Qualifier the Qualifiers will contain; must not be null
      Returns:
      a Qualifiers
      Throws:
      NullPointerException - if qualifier is null
      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.
    • of

      public static final <V> Qualifiers<V> of(Qualifier<V> qualifier0, Qualifier<V> qualifier1)
      Returns a Qualifiers, which may or may not be newly created, representing the supplied arguments.
      Type Parameters:
      V - the type of the Qualifier's attribute values
      Parameters:
      qualifier0 - the first Qualifier the Qualifiers will contain; must not be null
      qualifier1 - the second Qualifier the Qualifiers will contain; must not be null
      Returns:
      a Qualifiers
      Throws:
      NullPointerException - if qualifier is null
      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.
    • of

      public static final <V> Qualifiers<V> of(Iterable<? extends Qualifier<V>> qualifiers)
      Returns a Qualifiers, which may or may not be newly created, representing the supplied arguments.
      Type Parameters:
      V - the type of the Qualifier's attribute values
      Parameters:
      qualifiers - an Iterable representing Qualifier instances the Qualifiers will contain; may be null
      Returns:
      a Qualifiers
      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.
    • ofDisparate

      public static final Qualifiers<?> ofDisparate(Qualifier<?> qualifier0, Qualifier<?> qualifier1)
      Returns a Qualifiers, which may or may not be newly created, representing the supplied arguments.
      Parameters:
      qualifier0 - the first Qualifier the Qualifiers will contain; must not be null
      qualifier1 - the second Qualifier the Qualifiers will contain; must not be null
      Returns:
      a Qualifiers
      Throws:
      NullPointerException - if qualifier is null
      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.
    • ofDisparate

      public static final Qualifiers<?> ofDisparate(Iterable<? extends Qualifier<?>> qualifiers)
      Returns a Qualifiers, which may or may not be newly created, representing the supplied arguments.
      Parameters:
      qualifiers - an Iterable representing Qualifier instances the Qualifiers will contain; may be null
      Returns:
      a Qualifiers
      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.