List of usage examples for com.fasterxml.jackson.core JsonParser getText
public abstract String getText() throws IOException, JsonParseException;
From source file:com.inversoft.json.LocalDateDeserializer.java
@Override public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return LocalDate.parse(jp.getText()); }
From source file:com.skcraft.launcher.model.minecraft.PlatformDeserializer.java
@Override public Platform deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { String text = jsonParser.getText(); if (text.equalsIgnoreCase("windows")) { return Platform.WINDOWS; } else if (text.equalsIgnoreCase("linux")) { return Platform.LINUX; } else if (text.equalsIgnoreCase("solaris")) { return Platform.SOLARIS; } else if (text.equalsIgnoreCase("osx")) { return Platform.MAC_OS_X; } else {/*from w w w . j ava 2 s . co m*/ throw new IOException("Unknown platform: " + text); } }
From source file:info.losd.galen.json.StringToInstantDeserializer.java
@Override public Instant deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return Instant.parse(jp.getText()); }
From source file:com.centurylink.cloud.sdk.core.config.OffsetDateTimeDeserializer.java
@Override public OffsetDateTime deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException, JsonProcessingException { return OffsetDateTime.parse(arg0.getText()); }
From source file:com.jive.myco.seyren.core.util.datetime.LocalTimeDeserializer.java
@Override public LocalTime deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { String raw = parser.getText(); if (raw == null || raw.length() != 4) { return null; }/*from ww w .j ava2 s . c o m*/ int hours = Integer.valueOf(raw.substring(0, 2)); int mins = Integer.valueOf(raw.substring(2)); return new LocalTime(hours, mins); }
From source file:net.morimekta.providence.jackson.BinaryJsonDeserializer.java
@Override public Binary deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return Binary.fromBase64(jp.getText()); }
From source file:org.mayocat.rest.jackson.DateTimeISO8601Deserializer.java
@Override public DateTime deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { String str = parser.getText().trim(); if (Strings.isNullOrEmpty(str)) { return null; }/*from ww w . j a v a 2 s . c o m*/ ConfigurationService configurationService = Utils.getComponent(ConfigurationService.class); GeneralSettings settings = configurationService.getSettings(GeneralSettings.class); return new DateTime(str, DateTimeZone.forTimeZone(settings.getTime().getTimeZone().getValue())); }
From source file:org.agorava.facebook.jackson.RsvpStatusDeserializer.java
@Override public RsvpStatus deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return RsvpStatus.valueOf(jp.getText().toUpperCase()); }
From source file:org.agorava.twitter.jackson.PlaceTypeDeserializer.java
@Override public PlaceType deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String placeTypeText = jp.getText().toUpperCase(); if (placeTypeText.equals("POI")) { return PlaceType.POINT_OF_INTEREST; }// w w w . ja v a 2 s .c om return PlaceType.valueOf(jp.getText().toUpperCase()); }
From source file:info.archinnov.achilles.json.CounterDeserializer.java
@Override public Counter deserialize(JsonParser parser, DeserializationContext context) throws IOException { Counter counter = null;//w ww . ja va 2 s .com String value = parser.getText(); if (value != null && !"".equals(value.trim())) { try { counter = CounterBuilder.incr(Long.parseLong(value)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Cannot deserialize '" + value + "' as Long for Counter "); } } return counter; }