@@ -898,22 +898,22 @@ public <T> T[] arrayOfFrom(Class<T> type, Object source) throws IOException, JSO
898
898
}
899
899
900
900
@ SuppressWarnings ("unchecked" )
901
- public < T > Map <T ,Object > mapFrom (Object source ) throws IOException , JSONObjectException
901
+ public Map <String ,Object > mapFrom (Object source ) throws IOException , JSONObjectException
902
902
{
903
903
if (source instanceof JsonParser ) {
904
904
JsonParser p = _initForReading ((JsonParser ) source );
905
- Map <Object , Object > result = _readerForOperation (p ).readMap ();
905
+ Map <?,? > result = _readerForOperation (p ).readMap ();
906
906
p .clearCurrentToken ();
907
- return (Map <T ,Object >) result ;
907
+ return (Map <String ,Object >) result ;
908
908
}
909
909
JsonParser p = _parser (source );
910
910
try {
911
911
_initForReading (_config (p ));
912
- Map <Object , Object > result = _readerForOperation (p ).readMap ();
912
+ Map <?,? > result = _readerForOperation (p ).readMap ();
913
913
JsonParser p0 = p ;
914
914
p = null ;
915
915
_close (p0 , null );
916
- return (Map <T ,Object >) result ;
916
+ return (Map <String ,Object >) result ;
917
917
} catch (Exception e ) {
918
918
return _closeWithError (p , e );
919
919
}
@@ -987,7 +987,7 @@ public Object anyFrom(Object source) throws IOException
987
987
* @since 2.8
988
988
*/
989
989
@ SuppressWarnings ("unchecked" )
990
- public <T extends TreeNode > TreeNode treeFrom (Object source )
990
+ public <T extends TreeNode > T treeFrom (Object source )
991
991
throws IOException , JSONObjectException
992
992
{
993
993
if (_treeCodec == null ) {
@@ -1028,7 +1028,7 @@ public <T extends TreeNode> TreeNode treeFrom(Object source)
1028
1028
* @since 2.10
1029
1029
*/
1030
1030
public <T > ValueIterator <T > beanSequenceFrom (Class <T > type , Object source )
1031
- throws IOException , JSONObjectException
1031
+ throws IOException , JSONObjectException
1032
1032
{
1033
1033
JsonParser p ;
1034
1034
final boolean managed = !(source instanceof JsonParser );
@@ -1040,19 +1040,21 @@ public <T> ValueIterator<T> beanSequenceFrom(Class<T> type, Object source)
1040
1040
}
1041
1041
p = _initForReading (_config (p ));
1042
1042
JSONReader reader = _readerForOperation (p );
1043
- return new ValueIterator <T >(ValueIterator .MODE_BEAN , type , p , reader , managed );
1043
+ return new ValueIterator <T >(ValueIterator .MODE_BEAN , type ,
1044
+ p , reader , _treeCodec , managed );
1044
1045
}
1045
1046
1046
1047
/**
1047
1048
* Method for creating {@link ValueIterator} for reading
1048
1049
* <a href="https://en.wikipedia.org/wiki/JSON_streaming">streaming JSON</a>
1049
1050
* content (specifically line-delimited and concatenated variants);
1050
- * individual values are bound as "Any " type: {@link java.util.Map},
1051
+ * individual values are bound as "Simple " type: {@link java.util.Map},
1051
1052
* {@link java.util.List}, {@link String}, {@link Number} or {@link Boolean}.
1052
1053
*
1053
1054
* @since 2.10
1054
1055
*/
1055
- public ValueIterator <Object > anySequenceFrom (Object source ) throws IOException
1056
+ public ValueIterator <Object > anySequenceFrom (Object source )
1057
+ throws IOException , JSONObjectException
1056
1058
{
1057
1059
JsonParser p ;
1058
1060
final boolean managed = !(source instanceof JsonParser );
@@ -1064,9 +1066,38 @@ public ValueIterator<Object> anySequenceFrom(Object source) throws IOException
1064
1066
}
1065
1067
p = _initForReading (_config (p ));
1066
1068
JSONReader reader = _readerForOperation (p );
1067
- return new ValueIterator <Object >(ValueIterator .MODE_ANY , Object .class , p , reader , managed );
1069
+ return new ValueIterator <Object >(ValueIterator .MODE_ANY , Object .class ,
1070
+ p , reader , _treeCodec , managed );
1068
1071
}
1069
-
1072
+
1073
+ /**
1074
+ * Method for creating {@link ValueIterator} for reading
1075
+ * <a href="https://en.wikipedia.org/wiki/JSON_streaming">streaming JSON</a>
1076
+ * content (specifically line-delimited and concatenated variants);
1077
+ * individual values are bound as JSON Trees(of type that configured
1078
+ * {@link TreeCodec}, see {@link #with(TreeCodec)}) supports.
1079
+ */
1080
+ public <T extends TreeNode > ValueIterator <T > treeSequenceFrom (Object source )
1081
+ throws IOException , JSONObjectException
1082
+ {
1083
+ if (_treeCodec == null ) {
1084
+ _noTreeCodec ("read TreeNode" );
1085
+ }
1086
+
1087
+ JsonParser p ;
1088
+ final boolean managed = !(source instanceof JsonParser );
1089
+
1090
+ if (managed ) {
1091
+ p = _parser (source );
1092
+ } else {
1093
+ p = (JsonParser ) source ;
1094
+ }
1095
+ p = _initForReading (_config (p ));
1096
+ JSONReader reader = _readerForOperation (p );
1097
+ return new ValueIterator <T >(ValueIterator .MODE_TREE , TreeNode .class ,
1098
+ p , reader , _treeCodec , managed );
1099
+ }
1100
+
1070
1101
/*
1071
1102
/**********************************************************************
1072
1103
/* API: TreeNode construction
0 commit comments