Available Methods
- nextToken ( )
- currentToken ( )
- getCurrentName ( )
- getText ( )
- getCurrentToken ( )
- skipChildren ( )
- nextValue ( )
- getCodec ( )
- getLongValue ( )
- getIntValue ( )
- readValueAs ( )
- getValueAsString ( )
- readValueAsTree ( )
- close ( )
- getFloatValue ( )
- getCurrentLocation ( )
- hasToken ( )
- nextTextValue ( )
- getBooleanValue ( )
- isExpectedStartArrayToken ( )
- getBinaryValue ( )
- getByteValue ( )
- getShortValue ( )
- getValueAsInt ( )
- getDoubleValue ( )
- getTokenLocation ( )
- nextFieldName ( )
- setCodec ( )
- getEmbeddedObject ( )
- isClosed ( )
- getValueAsDouble ( )
- hasCurrentToken ( )
- Feature ( )
- setCurrentValue ( )
- getValueAsLong ( )
- NumberType ( )
- nextIntValue ( )
- isExpectedStartObjectToken ( )
- hasTokenId ( )
- getCurrentTokenId ( )
- getTextCharacters ( )
- currentName ( )
- getDecimalValue ( )
- getValueAsBoolean ( )
Related Classes
- java.util.Arrays
- java.io.File
- java.util.Collections
- java.io.InputStream
- java.util.Date
- java.util.Iterator
- java.net.URL
- java.io.ByteArrayInputStream
- java.util.Optional
- java.nio.charset.StandardCharsets
- java.text.ParseException
- com.fasterxml.jackson.databind.ObjectMapper
- java.math.BigDecimal
- java.math.BigInteger
- java.nio.file.Path
- java.io.Reader
- org.apache.commons.lang3.StringUtils
- com.google.common.collect.Lists
- com.fasterxml.jackson.core.JsonProcessingException
- java.time.LocalDateTime
- javax.annotation.Nullable
- com.google.common.base.Preconditions
- com.fasterxml.jackson.databind.JsonNode
- org.junit.jupiter.api.Test
- com.fasterxml.jackson.annotation.JsonInclude
Java Code Examples for com.fasterxml.jackson.core.JsonParser#getCurrentTokenId()
The following examples show how to use
com.fasterxml.jackson.core.JsonParser#getCurrentTokenId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Bean2Deserializer.java From blog with BSD 2-Clause "Simplified" License | 6 votes |
@Override public Bean2 deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { Bean2 bean2 = new Bean2(); p.nextToken(); do { String propName = p.getCurrentName(); if (propName == null) { break; } if (p.getCurrentTokenId() != JsonTokenId.ID_FIELD_NAME && propName.equals("p1")) { bean2.setP1(p.getText()); } else if (p.getCurrentTokenId() != JsonTokenId.ID_FIELD_NAME && propName.equals("p2")) { bean2.setP2(new BigDecimal(p.getText())); } } while (p.nextToken() != null); return bean2; }
Example 2
Source File: DurationDeserializer.java From bootique with Apache License 2.0 | 6 votes |
@Override public Duration deserialize(JsonParser parser, DeserializationContext context) throws IOException { switch (parser.getCurrentTokenId()) { case JsonTokenId.ID_NUMBER_FLOAT: BigDecimal value = parser.getDecimalValue(); long seconds = value.longValue(); int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); return Duration.ofSeconds(seconds, nanoseconds); case JsonTokenId.ID_NUMBER_INT: return Duration.ofSeconds(parser.getLongValue()); case JsonTokenId.ID_STRING: String string = parser.getText().trim(); if (string.length() == 0) { return null; } return Duration.parse(string); } throw context.mappingException("Expected type float, integer, or string."); }