@@ -1419,6 +1419,8 @@ public void writeTree(JsonGenerator g, TreeNode rootNode) {
1419
1419
* using configuration of this reader.
1420
1420
* Value return is either newly constructed, or root value that
1421
1421
* was specified with {@link #withValueToUpdate(Object)}.
1422
+ *
1423
+ * @param src Source to read content from
1422
1424
*/
1423
1425
@ SuppressWarnings ("unchecked" )
1424
1426
public <T > T readValue (InputStream src ) throws IOException
@@ -1429,11 +1431,28 @@ public <T> T readValue(InputStream src) throws IOException
1429
1431
return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1430
1432
}
1431
1433
1434
+ /**
1435
+ * Same as {@link #readValue(InputStream)} except that target value type
1436
+ * overridden as {@code valueType}
1437
+ *
1438
+ * @param src Source to read content from
1439
+ * @param valueType Target type to bind content to
1440
+ *
1441
+ * @since 2.11
1442
+ */
1443
+ @ SuppressWarnings ("unchecked" )
1444
+ public <T > T readValue (InputStream src , Class <T > valueType ) throws IOException
1445
+ {
1446
+ return (T ) forType (valueType ).readValue (src );
1447
+ }
1448
+
1432
1449
/**
1433
1450
* Method that binds content read from given input source,
1434
1451
* using configuration of this reader.
1435
1452
* Value return is either newly constructed, or root value that
1436
1453
* was specified with {@link #withValueToUpdate(Object)}.
1454
+ *
1455
+ * @param src Source to read content from
1437
1456
*/
1438
1457
@ SuppressWarnings ("unchecked" )
1439
1458
public <T > T readValue (Reader src ) throws IOException
@@ -1444,11 +1463,28 @@ public <T> T readValue(Reader src) throws IOException
1444
1463
return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1445
1464
}
1446
1465
1466
+ /**
1467
+ * Same as {@link #readValue(Reader)} except that target value type
1468
+ * overridden as {@code valueType}
1469
+ *
1470
+ * @param src Source to read content from
1471
+ * @param valueType Target type to bind content to
1472
+ *
1473
+ * @since 2.11
1474
+ */
1475
+ @ SuppressWarnings ("unchecked" )
1476
+ public <T > T readValue (Reader src , Class <T > valueType ) throws IOException
1477
+ {
1478
+ return (T ) forType (valueType ).readValue (src );
1479
+ }
1480
+
1447
1481
/**
1448
1482
* Method that binds content read from given JSON string,
1449
1483
* using configuration of this reader.
1450
1484
* Value return is either newly constructed, or root value that
1451
1485
* was specified with {@link #withValueToUpdate(Object)}.
1486
+ *
1487
+ * @param src String that contains content to read
1452
1488
*/
1453
1489
@ SuppressWarnings ("unchecked" )
1454
1490
public <T > T readValue (String src ) throws JsonProcessingException , JsonMappingException
@@ -1465,37 +1501,98 @@ public <T> T readValue(String src) throws JsonProcessingException, JsonMappingEx
1465
1501
}
1466
1502
}
1467
1503
1504
+ /**
1505
+ * Same as {@link #readValue(String)} except that target value type
1506
+ * overridden as {@code valueType}
1507
+ *
1508
+ * @param src String that contains content to read
1509
+ * @param valueType Target type to bind content to
1510
+ *
1511
+ * @since 2.11
1512
+ */
1513
+ @ SuppressWarnings ("unchecked" )
1514
+ public <T > T readValue (String src , Class <T > valueType ) throws IOException
1515
+ {
1516
+ return (T ) forType (valueType ).readValue (src );
1517
+ }
1518
+
1468
1519
/**
1469
1520
* Method that binds content read from given byte array,
1470
1521
* using configuration of this reader.
1471
1522
* Value return is either newly constructed, or root value that
1472
1523
* was specified with {@link #withValueToUpdate(Object)}.
1524
+ *
1525
+ * @param content Byte array that contains encoded content to read
1473
1526
*/
1474
1527
@ SuppressWarnings ("unchecked" )
1475
- public <T > T readValue (byte [] src ) throws IOException
1528
+ public <T > T readValue (byte [] content ) throws IOException
1476
1529
{
1477
1530
if (_dataFormatReaders != null ) {
1478
- return (T ) _detectBindAndClose (src , 0 , src .length );
1531
+ return (T ) _detectBindAndClose (content , 0 , content .length );
1479
1532
}
1480
- return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1533
+ return (T ) _bindAndClose (_considerFilter (createParser (content ), false ));
1534
+ }
1535
+
1536
+ /**
1537
+ * Same as {@link #readValue(byte[])} except that target value type
1538
+ * overridden as {@code valueType}
1539
+ *
1540
+ * @param content Byte array that contains encoded content to read
1541
+ * @param valueType Target type to bind content to
1542
+ *
1543
+ * @since 2.11
1544
+ */
1545
+ @ SuppressWarnings ("unchecked" )
1546
+ public <T > T readValue (byte [] content , Class <T > valueType ) throws IOException
1547
+ {
1548
+ return (T ) forType (valueType ).readValue (content );
1481
1549
}
1482
1550
1483
1551
/**
1484
1552
* Method that binds content read from given byte array,
1485
1553
* using configuration of this reader.
1486
1554
* Value return is either newly constructed, or root value that
1487
1555
* was specified with {@link #withValueToUpdate(Object)}.
1556
+ *
1557
+ * @param buffer Byte array that contains encoded content to read
1558
+ * @param offset Offset of the first content byte in {@code buffer}
1559
+ * @param length Length of content in {@code buffer}, in bytes
1488
1560
*/
1489
1561
@ SuppressWarnings ("unchecked" )
1490
- public <T > T readValue (byte [] src , int offset , int length ) throws IOException
1562
+ public <T > T readValue (byte [] buffer , int offset , int length ) throws IOException
1491
1563
{
1492
1564
if (_dataFormatReaders != null ) {
1493
- return (T ) _detectBindAndClose (src , offset , length );
1565
+ return (T ) _detectBindAndClose (buffer , offset , length );
1494
1566
}
1495
- return (T ) _bindAndClose (_considerFilter (createParser (src , offset , length ),
1567
+ return (T ) _bindAndClose (_considerFilter (createParser (buffer , offset , length ),
1496
1568
false ));
1497
1569
}
1498
-
1570
+
1571
+ /**
1572
+ * Same as {@link #readValue(byte[],int,int)} except that target value type
1573
+ * overridden as {@code valueType}
1574
+ *
1575
+ * @param buffer Byte array that contains encoded content to read
1576
+ * @param offset Offset of the first content byte in {@code buffer}
1577
+ * @param length Length of content in {@code buffer}, in bytes
1578
+ * @param valueType Target type to bind content to
1579
+ *
1580
+ * @since 2.11
1581
+ */
1582
+ @ SuppressWarnings ("unchecked" )
1583
+ public <T > T readValue (byte [] buffer , int offset , int length , Class <T > valueType ) throws IOException
1584
+ {
1585
+ return (T ) forType (valueType ).readValue (buffer , offset , length );
1586
+ }
1587
+
1588
+ /**
1589
+ * Method that binds content read from given {@link File}
1590
+ * using configuration of this reader.
1591
+ * Value return is either newly constructed, or root value that
1592
+ * was specified with {@link #withValueToUpdate(Object)}.
1593
+ *
1594
+ * @param src File that contains content to read
1595
+ */
1499
1596
@ SuppressWarnings ("unchecked" )
1500
1597
public <T > T readValue (File src ) throws IOException
1501
1598
{
@@ -1506,6 +1603,21 @@ public <T> T readValue(File src) throws IOException
1506
1603
return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1507
1604
}
1508
1605
1606
+ /**
1607
+ * Same as {@link #readValue(File)} except that target value type
1608
+ * overridden as {@code valueType}
1609
+ *
1610
+ * @param src File that contains content to read
1611
+ * @param valueType Target type to bind content to
1612
+ *
1613
+ * @since 2.11
1614
+ */
1615
+ @ SuppressWarnings ("unchecked" )
1616
+ public <T > T readValue (File src , Class <T > valueType ) throws IOException
1617
+ {
1618
+ return (T ) forType (valueType ).readValue (src );
1619
+ }
1620
+
1509
1621
/**
1510
1622
* Method that binds content read from given input source,
1511
1623
* using configuration of this reader.
@@ -1528,26 +1640,55 @@ public <T> T readValue(URL src) throws IOException
1528
1640
return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1529
1641
}
1530
1642
1643
+ /**
1644
+ * Same as {@link #readValue(URL)} except that target value type
1645
+ * overridden as {@code valueType}
1646
+ *
1647
+ * @param src URL pointing to resource that contains content to read
1648
+ * @param valueType Target type to bind content to
1649
+ *
1650
+ * @since 2.11
1651
+ */
1652
+ @ SuppressWarnings ("unchecked" )
1653
+ public <T > T readValue (URL src , Class <T > valueType ) throws IOException
1654
+ {
1655
+ return (T ) forType (valueType ).readValue (src );
1656
+ }
1657
+
1531
1658
/**
1532
1659
* Convenience method for converting results from given JSON tree into given
1533
1660
* value type. Basically short-cut for:
1534
1661
*<pre>
1535
1662
* objectReader.readValue(src.traverse())
1536
1663
*</pre>
1664
+ *
1665
+ * @param content Tree that contains content to convert
1537
1666
*/
1538
1667
@ SuppressWarnings ({ "unchecked" })
1539
- public <T > T readValue (JsonNode src ) throws IOException
1668
+ public <T > T readValue (JsonNode content ) throws IOException
1540
1669
{
1541
- _assertNotNull ("src " , src );
1670
+ _assertNotNull ("content " , content );
1542
1671
if (_dataFormatReaders != null ) {
1543
- _reportUndetectableSource (src );
1672
+ _reportUndetectableSource (content );
1544
1673
}
1545
- return (T ) _bindAndClose (_considerFilter (treeAsTokens (src ), false ));
1674
+ return (T ) _bindAndClose (_considerFilter (treeAsTokens (content ), false ));
1546
1675
}
1547
1676
1548
1677
/**
1549
- * @since 2.8
1678
+ * Same as {@link #readValue(JsonNode)} except that target value type
1679
+ * overridden as {@code valueType}
1680
+ *
1681
+ * @param content Tree that contains content to convert
1682
+ * @param valueType Target type to convert content to
1683
+ *
1684
+ * @since 2.11
1550
1685
*/
1686
+ @ SuppressWarnings ({ "unchecked" })
1687
+ public <T > T readValue (JsonNode content , Class <T > valueType ) throws IOException
1688
+ {
1689
+ return (T ) forType (valueType ).readValue (content );
1690
+ }
1691
+
1551
1692
@ SuppressWarnings ("unchecked" )
1552
1693
public <T > T readValue (DataInput src ) throws IOException
1553
1694
{
@@ -1557,6 +1698,21 @@ public <T> T readValue(DataInput src) throws IOException
1557
1698
return (T ) _bindAndClose (_considerFilter (createParser (src ), false ));
1558
1699
}
1559
1700
1701
+ /**
1702
+ * Same as {@link #readValue(DataInput)} except that target value type
1703
+ * overridden as {@code valueType}
1704
+ *
1705
+ * @param content DataInput that contains content to read
1706
+ * @param valueType Target type to bind content to
1707
+ *
1708
+ * @since 2.11
1709
+ */
1710
+ @ SuppressWarnings ("unchecked" )
1711
+ public <T > T readValue (DataInput content , Class <T > valueType ) throws IOException
1712
+ {
1713
+ return (T ) forType (valueType ).readValue (content );
1714
+ }
1715
+
1560
1716
/*
1561
1717
/**********************************************************
1562
1718
/* Deserialization methods; JsonNode ("tree")
0 commit comments