Example usage for com.fasterxml.jackson.core JsonParser getText

List of usage examples for com.fasterxml.jackson.core JsonParser getText

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonParser getText.

Prototype

public abstract String getText() throws IOException, JsonParseException;

Source Link

Document

Method for accessing textual representation of the current token; if no current token (before first call to #nextToken , or after encountering end-of-input), returns null.

Usage

From source file:com.jive.myco.seyren.core.util.math.BigDecimalDeserializer.java

@Override
public BigDecimal deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    return jp.getText() != null ? new BigDecimal(jp.getText()) : null;
}

From source file:ch.rasc.wampspring.demo.various.scheduler.LocalDateTimeDeserializer.java

@Override
public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    if (jp.getText().contains("+") || jp.getText().endsWith("Z")) {
        return ZonedDateTime.parse(jp.getText()).toLocalDateTime();
    }/*from w  ww  . ja v  a  2 s.  co m*/
    return LocalDateTime.parse(jp.getText());
}

From source file:ca.qhrtech.utilities.LocalDateTimeDeserializer.java

@Override
public LocalDateTime deserialize(JsonParser jp, DeserializationContext dc)
        throws IOException, JsonProcessingException {
    return LocalDateTime.parse(jp.getText());
}

From source file:com.ga2sa.utils.StringToBooleanDeserializer.java

@Override
public Boolean deserialize(JsonParser jsonParser, DeserializationContext arg1)
        throws IOException, JsonProcessingException {
    return jsonParser.getText().equals("on");
}

From source file:jp.xet.baseunits.jackson2.TimePointDeserializer.java

@Override
public TimePoint deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    try {//from  w  w  w . ja  va2  s  .  c  o m
        return TimePoint.parse(jp.getText(), TimePoint.ISO8601_FORMAT_UNIVERSAL, TimeZones.UNIVERSAL);
    } catch (ParseException e) {
        return null;
    }
}

From source file:com.todev.rabbitmqmanagement.data.network.serialization.UserTagsDeserializer.java

@Override
public List<User.Tag> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    String serialized = p.getText().trim();
    StringTokenizer tokenizer = new StringTokenizer(serialized, ",");
    List<User.Tag> result = new ArrayList<>();
    User.Tag tag = User.Tag.NONE;//from w w w  . j  av a 2  s  .c  o  m

    while (tokenizer.hasMoreElements()) {
        String token = tokenizer.nextToken();

        try {
            tag = User.Tag.valueOf(token.toUpperCase());
        } catch (IllegalArgumentException e) {
            // Leave none type as default.
        }

        if (!result.contains(tag)) {
            result.add(tag);
        }
    }

    return result;
}

From source file:com.microsoft.azure.keyvault.webkey.Base64UrlJsonDeserializer.java

@Override
public byte[] deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    String text = jp.getText();
    if (text != null) {
        return BASE64.decode(text);
    }/*from w w  w. j a  v  a 2  s.  com*/
    return null;
}

From source file:ch.rasc.portaldemos.scheduler.ISO8601DateTimeDeserializer.java

@Override
public DateTime deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    return DateTime.parse(jp.getText());
}

From source file:ijfx.service.workflow.json.FileDeserializer.java

@Override
public File deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException {

    return deserialize(jp.getText());
}

From source file:org.craftercms.commons.jackson.ObjectIdDeserializer.java

@Override
public ObjectId deserialize(final JsonParser jsonParser, final DeserializationContext context)
        throws IOException {
    return new ObjectId(jsonParser.getText());
}