@@ -537,6 +537,47 @@ public void setSchema(FormatSchema schema) {
537
537
@ Override
538
538
public abstract void close () throws IOException ;
539
539
540
+ /**
541
+ * Method that can be called to determine whether this parser
542
+ * is closed or not. If it is closed, no new tokens can be
543
+ * retrieved by calling {@link #nextToken} (and the underlying
544
+ * stream may be closed). Closing may be due to an explicit
545
+ * call to {@link #close} or because parser has encountered
546
+ * end of input.
547
+ */
548
+ public abstract boolean isClosed ();
549
+
550
+ /*
551
+ /**********************************************************
552
+ /* Public API, simple location, context accessors
553
+ /**********************************************************
554
+ */
555
+
556
+ /**
557
+ * Method that can be used to access current parsing context reader
558
+ * is in. There are 3 different types: root, array and object contexts,
559
+ * with slightly different available information. Contexts are
560
+ * hierarchically nested, and can be used for example for figuring
561
+ * out part of the input document that correspond to specific
562
+ * array or object (for highlighting purposes, or error reporting).
563
+ * Contexts can also be used for simple xpath-like matching of
564
+ * input, if so desired.
565
+ */
566
+ public abstract JsonStreamContext getParsingContext ();
567
+
568
+ /**
569
+ * Method that return the <b>starting</b> location of the current
570
+ * token; that is, position of the first character from input
571
+ * that starts the current token.
572
+ */
573
+ public abstract JsonLocation getTokenLocation ();
574
+
575
+ /**
576
+ * Method that returns location of the last processed character;
577
+ * usually for error reporting purposes.
578
+ */
579
+ public abstract JsonLocation getCurrentLocation ();
580
+
540
581
/*
541
582
/**********************************************************
542
583
/* Buffer handling
@@ -857,19 +898,9 @@ public void finishToken() throws IOException {
857
898
; // nothing
858
899
}
859
900
860
- /**
861
- * Method that can be called to determine whether this parser
862
- * is closed or not. If it is closed, no new tokens can be
863
- * retrieved by calling {@link #nextToken} (and the underlying
864
- * stream may be closed). Closing may be due to an explicit
865
- * call to {@link #close} or because parser has encountered
866
- * end of input.
867
- */
868
- public abstract boolean isClosed ();
869
-
870
901
/*
871
902
/**********************************************************
872
- /* Public API, token accessors
903
+ /* Public API, simple token id/type access
873
904
/**********************************************************
874
905
*/
875
906
@@ -959,40 +990,6 @@ public int currentTokenId() {
959
990
* @since 2.6
960
991
*/
961
992
public abstract boolean hasToken (JsonToken t );
962
-
963
- /**
964
- * Method that can be called to get the name associated with
965
- * the current token: for {@link JsonToken#FIELD_NAME}s it will
966
- * be the same as what {@link #getText} returns;
967
- * for field values it will be preceding field name;
968
- * and for others (array values, root-level values) null.
969
- */
970
- public abstract String getCurrentName () throws IOException ;
971
-
972
- /**
973
- * Method that can be used to access current parsing context reader
974
- * is in. There are 3 different types: root, array and object contexts,
975
- * with slightly different available information. Contexts are
976
- * hierarchically nested, and can be used for example for figuring
977
- * out part of the input document that correspond to specific
978
- * array or object (for highlighting purposes, or error reporting).
979
- * Contexts can also be used for simple xpath-like matching of
980
- * input, if so desired.
981
- */
982
- public abstract JsonStreamContext getParsingContext ();
983
-
984
- /**
985
- * Method that return the <b>starting</b> location of the current
986
- * token; that is, position of the first character from input
987
- * that starts the current token.
988
- */
989
- public abstract JsonLocation getTokenLocation ();
990
-
991
- /**
992
- * Method that returns location of the last processed character;
993
- * usually for error reporting purposes.
994
- */
995
- public abstract JsonLocation getCurrentLocation ();
996
993
997
994
/**
998
995
* Specialized accessor that can be used to verify that the current
@@ -1022,7 +1019,18 @@ public int currentTokenId() {
1022
1019
* @since 2.5
1023
1020
*/
1024
1021
public boolean isExpectedStartObjectToken () { return currentToken () == JsonToken .START_OBJECT ; }
1025
-
1022
+
1023
+ /**
1024
+ * Access for checking whether current token is a numeric value token, but
1025
+ * one that is of "not-a-number" (NaN) variety: not supported by all formats,
1026
+ * but often supported for {@link JsonToken#VALUE_NUMBER_FLOAT}.
1027
+ *
1028
+ * @since 2.9
1029
+ */
1030
+ public boolean isNaN () {
1031
+ return false ;
1032
+ }
1033
+
1026
1034
/*
1027
1035
/**********************************************************
1028
1036
/* Public API, token state overrides
@@ -1071,6 +1079,15 @@ public int currentTokenId() {
1071
1079
/**********************************************************
1072
1080
*/
1073
1081
1082
+ /**
1083
+ * Method that can be called to get the name associated with
1084
+ * the current token: for {@link JsonToken#FIELD_NAME}s it will
1085
+ * be the same as what {@link #getText} returns;
1086
+ * for field values it will be preceding field name;
1087
+ * and for others (array values, root-level values) null.
1088
+ */
1089
+ public abstract String getCurrentName () throws IOException ;
1090
+
1074
1091
/**
1075
1092
* Method for accessing textual representation of the current token;
1076
1093
* if no current token (before first call to {@link #nextToken}, or
0 commit comments