List of usage examples for com.fasterxml.jackson.core JsonParser nextIntValue
public int nextIntValue(int defaultValue) throws IOException, JsonParseException
return (nextToken() == JsonToken.VALUE_NUMBER_INT) ?Usage
From source file:org.apache.olingo.client.core.edm.xml.TypeDefinitionDeserializer.java
@Override protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final TypeDefinitionImpl typeDefinition = new TypeDefinitionImpl(); for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { final JsonToken token = jp.getCurrentToken(); if (token == JsonToken.FIELD_NAME) { if ("Name".equals(jp.getCurrentName())) { typeDefinition.setName(jp.nextTextValue()); } else if ("UnderlyingType".equals(jp.getCurrentName())) { typeDefinition.setUnderlyingType(jp.nextTextValue()); } else if ("MaxLength".equals(jp.getCurrentName())) { typeDefinition.setMaxLength(jp.nextIntValue(0)); } else if ("Unicode".equals(jp.getCurrentName())) { typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue())); } else if ("Precision".equals(jp.getCurrentName())) { typeDefinition.setPrecision(jp.nextIntValue(0)); } else if ("Scale".equals(jp.getCurrentName())) { final String scale = jp.nextTextValue(); typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); } else if ("SRID".equals(jp.getCurrentName())) { final String srid = jp.nextTextValue(); if (srid != null) { typeDefinition.setSrid(SRID.valueOf(srid)); }/*from w ww . j ava 2s. com*/ } else if ("Annotation".equals(jp.getCurrentName())) { jp.nextToken(); typeDefinition.getAnnotations().add(jp.readValueAs(AnnotationImpl.class)); } } } return typeDefinition; }