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.redhat.red.build.koji.model.json.util.BuildSourceDeserializer.java

@Override
public BuildSource deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    String urlAndRev = jp.getText();
    String[] parts = urlAndRev.split("#");

    if (parts.length < 2 || isEmpty(parts[0]) || isEmpty(parts[1])) {
        throw new KojiJsonException(
                "Invalid build-source: '" + urlAndRev + "'. Must be of format '<base-url>#<commit-ish>'",
                jp.getCurrentLocation());
    }/*ww w  .j av a 2  s. c o m*/

    return new BuildSource(parts[0], parts[1]);
}

From source file:ca.ualberta.physics.cssdp.util.JSONURIDeserializer.java

@Override
public URI deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    try {/*from w w w.j a  v  a 2 s. com*/
        return new URI(jp.getText());
    } catch (URISyntaxException e) {
        logger.error("Could not deserialize json representation of URI " + jp.getText()
                + " into URI object because " + e.getMessage(), e);
    }
    return null;
}

From source file:org.wikidata.wdtk.datamodel.json.jackson.StatementRankDeserializer.java

@Override
public StatementRank deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    return StatementRank.valueOf(jp.getText().toUpperCase());
}

From source file:com.mattbertolini.statusboard.view.graph.ColorDeserializer.java

@Override
public Color deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
        throws IOException, JsonProcessingException {
    String text = jsonParser.getText();
    return Color.forColor(text);
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.DampeningTypeDeserializer.java

@Override
public DAMPENING_TYPE deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return DAMPENING_TYPE.fromString(nodeType);
    } else {/*from  w  w w .  j  av  a  2 s  .  co  m*/
        return null;
    }
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.FrequencyTypeDeserializer.java

@Override
public FREQUENCY_TYPE deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return FREQUENCY_TYPE.fromString(nodeType);
    } else {//www.j a va2  s. c o  m
        return null;
    }
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.GatewayTypeDeserializer.java

@Override
public GATEWAY_TYPE deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return GATEWAY_TYPE.fromString(nodeType);
    } else {//from  w  w w.  java2 s . c om
        return null;
    }
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.LogDirectionDeserializer.java

@Override
public LOG_DIRECTION deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return LOG_DIRECTION.fromString(nodeType);
    } else {/*from  ww  w. java  2s.com*/
        return null;
    }
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.LogLevelDeserializer.java

@Override
public LOG_LEVEL deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return LOG_LEVEL.fromString(nodeType);
    } else {//from   ww w .  j  a  v a  2 s  .  c o  m
        return null;
    }
}

From source file:org.mycontroller.standalone.api.jaxrs.mixins.deserializers.MessageTypeDeserializer.java

@Override
public MESSAGE_TYPE deserialize(JsonParser parser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    final String nodeType = parser.getText();
    if (nodeType != null) {
        return MESSAGE_TYPE.fromString(nodeType);
    } else {/* w ww.  ja  v  a2s  . c o  m*/
        return null;
    }
}