Package com.nimbusds.oauth2.sdk.id
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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
-
Constructor Summary
Constructors Constructor Description Audience(Identifier value)
Creates a new audience identifier with the specified value.Audience(String value)
Creates a new audience identifier with the specified value.Audience(URI value)
Creates a new audience identifier with the specified URI value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<Audience>
create(String... strings)
Creates an audience list from the specified string array.static List<Audience>
create(List<String> strings)
Creates an audience list from the specified string list representation.boolean
equals(Object object)
static boolean
matchesAny(Collection<Audience> c1, Collection<Audience> c2)
Returnstrue
if the specified collections have at at least one matching audience value.List<Audience>
toSingleAudienceList()
Returns a singleton list of this audience.static List<String>
toStringList(Audience audience)
Returns a string list representation of the specified audience.static List<String>
toStringList(List<Audience> audienceList)
Returns a string list representation of the specified audience list.-
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
-
-
-
Constructor Detail
-
Audience
public Audience(String value)
Creates a new audience identifier with the specified value.- Parameters:
value
- The audience identifier value. Must not benull
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 benull
.
-
Audience
public Audience(Identifier value)
Creates a new audience identifier with the specified value.- Parameters:
value
- The value. Must not benull
.
-
-
Method Detail
-
toSingleAudienceList
public List<Audience> 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 classIdentifier
-
toStringList
public static List<String> toStringList(Audience audience)
Returns a string list representation of the specified audience.- Parameters:
audience
- The audience. May benull
.- Returns:
- The string list,
null
if the argument wasnull
.
-
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 benull
.- Returns:
- The string list,
null
if the argument wasnull
.
-
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 benull
.- Returns:
- The audience list,
null
if the argument wasnull
.
-
create
public static List<Audience> create(String... strings)
Creates an audience list from the specified string array.- Parameters:
strings
- The strings. May benull
.- Returns:
- The audience list,
null
if the argument wasnull
.
-
matchesAny
public static boolean matchesAny(Collection<Audience> c1, Collection<Audience> c2)
Returnstrue
if the specified collections have at at least one matching audience value.- Parameters:
c1
- The first audience collection. May benull
.c2
- The second audience collection. May benull
.- Returns:
true
if the specified collections have at at least one matching audience value,false
if there are no matches or either collection isnull
or empty.
-
-