Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 4, 2021
1 parent 481afc0 commit 29c7b71
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/main/java/com/fasterxml/jackson/core/JsonToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public enum JsonToken
/**
* @param token representation for this token, if there is a
* single static representation; null otherwise
* @param id Numeric id from {@link JsonTokenId}
*/
JsonToken(String token, int id)
{
Expand Down Expand Up @@ -172,14 +173,21 @@ public enum JsonToken
public final char[] asCharArray() { return _serializedChars; }
public final byte[] asByteArray() { return _serializedBytes; }

/**
* @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT},
* {@code false} otherwise
*/
public final boolean isNumeric() { return _isNumber; }

/**
* Accessor that is functionally equivalent to:
* <code>
* this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY
* </code>
*
*
* @return {@code True} if this token is {@code START_OBJECT} or {@code START_ARRAY},
* {@code false} otherwise
*
* @since 2.3
*/
public final boolean isStructStart() { return _isStructStart; }
Expand All @@ -189,16 +197,28 @@ public enum JsonToken
* <code>
* this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY
* </code>
*
* @return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY},
* {@code false} otherwise
*
* @since 2.3
*/
public final boolean isStructEnd() { return _isStructEnd; }

/**
* Method that can be used to check whether this token represents
* a valid non-structured value. This means all tokens other than
* Object/Array start/end markers all field names.
* a valid non-structured value. This means all {@code VALUE_xxx} tokens;
* excluding {@code START_xxx} and {@code END_xxx} tokens as well
* {@code FIELD_NAME}.
*
* @return {@code True} if this token is a scalar value token (one of
* {@code VALUE_xxx} tokens), {@code false} otherwise
*/
public final boolean isScalarValue() { return _isScalar; }

/**
* @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE},
* {@code false} otherwise
*/
public final boolean isBoolean() { return _isBoolean; }
}

0 comments on commit 29c7b71

Please sign in to comment.