public abstract class JWObject extends Object
Provides a set of methods which are common across JWT, JWS, JWE and JWK implementations.
Constructor and Description |
---|
JWObject()
Constructs a new, empty JWObject.
|
Modifier and Type | Method and Description |
---|---|
protected 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.
|
JsonValue |
get(String key)
Returns the specified item value.
|
boolean |
isDefined(String key)
Returns
true 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.
|
Set<String> |
keys()
Returns the set of keys for this JWObject's values.
|
void |
put(String key,
Object value)
Sets or removes the value of the specified member.
|
JsonValue |
toJsonValue()
Returns a json representation of the JWObject.
|
String |
toString()
Returns a string representation of the JWObject.
|
protected void checkValueIsOfType(Object value, Class<?> requiredClazz)
Will throw a JwtRuntimeException if the value is not of the required type
value
- The value to check is of the required type.requiredClazz
- The class of the required type.JWObject.isValueOfType(Object, Class)
protected void checkListValuesAreOfType(List<?> value, Class<?> requiredClazz)
Will throw a JwtRuntimeException if the value is not of the required type
value
- The List to check the type is of the required type.requiredClazz
- The class of the required type.JWObject.checkValueIsOfType(Object, Class)
protected boolean isValueOfType(Object value, Class<?> requiredClazz)
value
- The value to check is of the required type.requiredClazz
- The class of the required type.true
if the value if of the required type.JWObject.checkValueIsOfType(Object, Class)
public void put(String key, Object value)
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.
key
- the Map
key identifying the value to set or to remove.value
- the object value to assign to the member.public JsonValue get(String key)
null
is
returned.key
- the Map
key identifying the item to return.null
.public boolean isDefined(String key)
true
if this JWObject contains the specified item.key
- the Map
key of the item to seek.true
if this JSON value contains the specified member.public Set<String> keys()
The order of the resulting keys is undefined. If there are no values set, this method returns an empty set.
public String toString()
public JsonValue toJsonValue()
Copyright © 2010-2018, ForgeRock All Rights Reserved.