Package org.forgerock.json.jose.jwt
Class JWObject
java.lang.Object
org.forgerock.json.jose.jwt.JWObject
- Direct Known Subclasses:
JWKSet
,JwtClaimsSet
,JwtHeader
A base implementation class for a JSON Web object.
Provides a set of methods which are common across JWT, JWS, JWE and JWK implementations.
- Since:
- 2.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkListValuesAreOfType
(List<?> value, Class<?> requiredClazz) Checks that the given List's type is of an assignable type from the required class.protected void
checkValueIsOfType
(Object value, Class<?> requiredClazz) Checks that the given value is of an assignable type from the required class.boolean
Returns the specified item value.int
hashCode()
boolean
Returnstrue
if this JWObject contains the specified item.protected boolean
isValueOfType
(Object value, Class<?> requiredClazz) Checks to see if the given value is of an assignable type from the required class.keys()
Returns the set of keys for this JWObject's values.void
Sets or removes the value of the specified member.Returns a json representation of the JWObject.toString()
Returns a string representation of the JWObject.
-
Constructor Details
-
JWObject
public JWObject()Constructs a new, empty JWObject.
-
-
Method Details
-
checkValueIsOfType
Checks that the given value is of an assignable type from the required class.Will throw a JwtRuntimeException if the value is not of the required type
- Parameters:
value
- The value to check is of the required type.requiredClazz
- The class of the required type.- See Also:
-
checkListValuesAreOfType
Checks that the given List's type is of an assignable type from the required class.Will throw a JwtRuntimeException if the value is not of the required type
- Parameters:
value
- The List to check the type is of the required type.requiredClazz
- The class of the required type.- See Also:
-
isValueOfType
Checks to see if the given value is of an assignable type from the required class.- Parameters:
value
- The value to check is of the required type.requiredClazz
- The class of the required type.- Returns:
true
if the value if of the required type.- See Also:
-
put
Sets or removes the value of the specified member.If the value is not null, then the value is set as the value of the given key.
Otherwise, if the value is null and the key already exist with a value assigned to it, then the key and its value will be removed. If the specified key is not defined, calling this method has no effect.
- Parameters:
key
- theMap
key identifying the value to set or to remove.value
- the object value to assign to the member.
-
get
Returns the specified item value. If no such member value exists, then a JSON value containingnull
is returned.- Parameters:
key
- theMap
key identifying the item to return.- Returns:
- a JSON value containing the value or
null
.
-
isDefined
Returnstrue
if this JWObject contains the specified item.- Parameters:
key
- theMap
key of the item to seek.- Returns:
true
if this JSON value contains the specified member.
-
keys
Returns the set of keys for this JWObject's values.The order of the resulting keys is undefined. If there are no values set, this method returns an empty set.
- Returns:
- A Set of keys.
-
toString
Returns a string representation of the JWObject. The result is guaranteed to be valid JSON object syntax. -
toJsonValue
Returns a json representation of the JWObject.- Returns:
- A JSON representation.
-
equals
-
hashCode
public int hashCode()
-