Parses text as a single Ion value. If the text contains more than that, a failure is thrown. @param text must not be null . @return a single value, not null .
(String text)
| 467 | * @return a single value, not <code>null</code>. |
| 468 | */ |
| 469 | public IonValue oneValue(String text) |
| 470 | { |
| 471 | IonValue value = null; |
| 472 | |
| 473 | Iterator<IonValue> iterator = system().iterate(text); |
| 474 | if (iterator.hasNext()) |
| 475 | { |
| 476 | value = iterator.next(); |
| 477 | |
| 478 | if (iterator.hasNext()) |
| 479 | { |
| 480 | IonValue part = iterator.next(); |
| 481 | fail("Found unexpected part <" + part + "> in text: " + text); |
| 482 | } |
| 483 | } |
| 484 | else |
| 485 | { |
| 486 | fail("No data found in text: " + text); |
| 487 | } |
| 488 | |
| 489 | return value; |
| 490 | } |
| 491 | |
| 492 | |
| 493 | public IonDecimal decimal(String text) |
no test coverage detected