Package com.auth0.jwt.impl
Class JsonNodeClaim
- java.lang.Object
-
- com.auth0.jwt.impl.JsonNodeClaim
-
-
Field Summary
Fields Modifier and Type Field Description private com.fasterxml.jackson.databind.JsonNodedataprivate com.fasterxml.jackson.databind.ObjectReaderobjectReader
-
Constructor Summary
Constructors Modifier Constructor Description privateJsonNodeClaim(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.ObjectReader objectReader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(java.lang.Class<T> tClazz)Get this Claim as a custom type T.<T> T[]asArray(java.lang.Class<T> tClazz)Get this Claim as an Array of type T.java.lang.BooleanasBoolean()Get this Claim as a Boolean.java.util.DateasDate()Get this Claim as a Date.java.lang.DoubleasDouble()Get this Claim as a Double.java.lang.IntegerasInt()Get this Claim as an Integer.<T> java.util.List<T>asList(java.lang.Class<T> tClazz)Get this Claim as a List of type T.java.lang.LongasLong()Get this Claim as an Long.java.util.Map<java.lang.String,java.lang.Object>asMap()Get this Claim as a generic Map of values.java.lang.StringasString()Get this Claim as a String.(package private) static ClaimclaimFromNode(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.ObjectReader objectReader)Helper method to create a Claim representation from the given JsonNode.(package private) static ClaimextractClaim(java.lang.String claimName, java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> tree, com.fasterxml.jackson.databind.ObjectReader objectReader)Helper method to extract a Claim from the given JsonNode tree.booleanisNull()Whether this Claim has a null value or not.
-
-
-
Method Detail
-
asBoolean
public java.lang.Boolean asBoolean()
Description copied from interface:ClaimGet this Claim as a Boolean. If the value isn't of type Boolean or it can't be converted to a Boolean, null will be returned.
-
asInt
public java.lang.Integer asInt()
Description copied from interface:ClaimGet this Claim as an Integer. If the value isn't of type Integer or it can't be converted to an Integer, null will be returned.
-
asLong
public java.lang.Long asLong()
Description copied from interface:ClaimGet this Claim as an Long. If the value isn't of type Long or it can't be converted to an Long, null will be returned.
-
asDouble
public java.lang.Double asDouble()
Description copied from interface:ClaimGet this Claim as a Double. If the value isn't of type Double or it can't be converted to a Double, null will be returned.
-
asString
public java.lang.String asString()
Description copied from interface:ClaimGet this Claim as a String. If the value isn't of type String or it can't be converted to a String, null will be returned.
-
asDate
public java.util.Date asDate()
Description copied from interface:ClaimGet this Claim as a Date. If the value can't be converted to a Date, null will be returned.
-
asArray
public <T> T[] asArray(java.lang.Class<T> tClazz) throws JWTDecodeExceptionDescription copied from interface:ClaimGet this Claim as an Array of type T. If the value isn't an Array, null will be returned.- Specified by:
asArrayin interfaceClaim- Type Parameters:
T- type- Parameters:
tClazz- the type class- Returns:
- the value as an Array or null.
- Throws:
JWTDecodeException- if the values inside the Array can't be converted to a class T.
-
asList
public <T> java.util.List<T> asList(java.lang.Class<T> tClazz) throws JWTDecodeExceptionDescription copied from interface:ClaimGet this Claim as a List of type T. If the value isn't an Array, null will be returned.- Specified by:
asListin interfaceClaim- Type Parameters:
T- type- Parameters:
tClazz- the type class- Returns:
- the value as a List or null.
- Throws:
JWTDecodeException- if the values inside the List can't be converted to a class T.
-
asMap
public java.util.Map<java.lang.String,java.lang.Object> asMap() throws JWTDecodeExceptionDescription copied from interface:ClaimGet this Claim as a generic Map of values.- Specified by:
asMapin interfaceClaim- Returns:
- the value as instance of Map.
- Throws:
JWTDecodeException- if the value can't be converted to a Map.
-
as
public <T> T as(java.lang.Class<T> tClazz) throws JWTDecodeExceptionDescription copied from interface:ClaimGet this Claim as a custom type T.- Specified by:
asin interfaceClaim- Type Parameters:
T- type- Parameters:
tClazz- the type class- Returns:
- the value as instance of T.
- Throws:
JWTDecodeException- if the value can't be converted to a class T.
-
isNull
public boolean isNull()
Description copied from interface:ClaimWhether this Claim has a null value or not.
-
extractClaim
static Claim extractClaim(java.lang.String claimName, java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> tree, com.fasterxml.jackson.databind.ObjectReader objectReader)
Helper method to extract a Claim from the given JsonNode tree.- Parameters:
claimName- the Claim to search for.tree- the JsonNode tree to search the Claim in.- Returns:
- a valid non-null Claim.
-
claimFromNode
static Claim claimFromNode(com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.ObjectReader objectReader)
Helper method to create a Claim representation from the given JsonNode.- Parameters:
node- the JsonNode to convert into a Claim.- Returns:
- a valid Claim instance. If the node is null or missing, a NullClaim will be returned.
-
-