Class Audience

java.lang.Object
com.nimbusds.oauth2.sdk.id.Identifier
com.nimbusds.oauth2.sdk.id.Audience
All Implemented Interfaces:
Serializable, Comparable<Identifier>, net.minidev.json.JSONAware

@Immutable public final class Audience extends Identifier
Audience identifier.

Provides helper methods for:

  • Converting to / from string arrays and collections
  • Matching audience values
See Also:
  • Constructor Details

    • Audience

      public Audience(String value)
      Creates a new audience identifier with the specified value.
      Parameters:
      value - The audience identifier value. Must not be null or empty string.
    • Audience

      public Audience(URI value)
      Creates a new audience identifier with the specified URI value.
      Parameters:
      value - The URI value. Must not be null.
    • Audience

      public Audience(Identifier value)
      Creates a new audience identifier with the specified value.
      Parameters:
      value - The value. Must not be null.
  • Method Details

    • toSingleAudienceList

      Returns a singleton list of this audience.
      Returns:
      A singleton list consisting of this audience only.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Identifier
    • toStringList

      public static List<String> toStringList(Audience audience)
      Returns a string list representation of the specified audience.
      Parameters:
      audience - The audience. May be null.
      Returns:
      The string list, null if the argument was null.
    • toStringList

      public static List<String> toStringList(List<Audience> audienceList)
      Returns a string list representation of the specified audience list.
      Parameters:
      audienceList - The audience list. May be null.
      Returns:
      The string list, null if the argument was null.
    • create

      public static List<Audience> create(List<String> strings)
      Creates an audience list from the specified string list representation.
      Parameters:
      strings - The string list. May be null.
      Returns:
      The audience list, null if the argument was null.
    • create

      public static List<Audience> create(String... strings)
      Creates an audience list from the specified string array.
      Parameters:
      strings - The strings. May be null.
      Returns:
      The audience list, null if the argument was null.
    • matchesAny

      public static boolean matchesAny(Collection<Audience> c1, Collection<Audience> c2)
      Returns true if the specified collections have at at least one matching audience value.
      Parameters:
      c1 - The first audience collection. May be null.
      c2 - The second audience collection. May be null.
      Returns:
      true if the specified collections have at at least one matching audience value, false if there are no matches or either collection is null or empty.