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

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

Introduction

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

Prototype

public String nextTextValue() throws IOException, JsonParseException 

Source Link

Document

Method that fetches next token (as if calling #nextToken ) and if it is JsonToken#VALUE_STRING returns contained String value; otherwise returns null.

Usage

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.v4.ActionDeserializer.java

@Override
protected Action doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    final Action action = new Action();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                action.setName(jp.nextTextValue());
            } else if ("IsBound".equals(jp.getCurrentName())) {
                action.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("EntitySetPath".equals(jp.getCurrentName())) {
                action.setEntitySetPath(jp.nextTextValue());
            } else if ("Parameter".equals(jp.getCurrentName())) {
                jp.nextToken();//from   ww w  .  ja  v  a 2 s  . c  om
                action.getParameters().add(jp.getCodec().readValue(jp, Parameter.class));
            } else if ("ReturnType".equals(jp.getCurrentName())) {
                action.setReturnType(parseReturnType(jp, "Action"));
            } else if ("Annotation".equals(jp.getCurrentName())) {
                jp.nextToken();
                action.setAnnotation(jp.getCodec().readValue(jp, Annotation.class));
            }
        }
    }

    return action;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.AssociationDeserializer.java

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

    final Association association = new Association();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                association.setName(jp.nextTextValue());
            } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
                jp.nextToken();/*from   w  w  w.  j  a v  a 2 s  .  c  o  m*/
                association.setReferentialConstraint(jp.getCodec().readValue(jp, ReferentialConstraint.class));
            } else if ("End".equals(jp.getCurrentName())) {
                jp.nextToken();
                association.getEnds().add(jp.getCodec().readValue(jp, AssociationEnd.class));
            }
        }
    }

    return association;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.v4.FunctionDeserializer.java

@Override
protected Function doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    final Function function = new Function();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                function.setName(jp.nextTextValue());
            } else if ("IsBound".equals(jp.getCurrentName())) {
                function.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("IsComposable".equals(jp.getCurrentName())) {
                function.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("EntitySetPath".equals(jp.getCurrentName())) {
                function.setEntitySetPath(jp.nextTextValue());
            } else if ("Parameter".equals(jp.getCurrentName())) {
                jp.nextToken();//from w w  w. j  a v a2s.c  o  m
                function.getParameters().add(jp.getCodec().readValue(jp, Parameter.class));
            } else if ("ReturnType".equals(jp.getCurrentName())) {
                function.setReturnType(parseReturnType(jp, "Function"));
            } else if ("Annotation".equals(jp.getCurrentName())) {
                jp.nextToken();
                function.setAnnotation(jp.getCodec().readValue(jp, Annotation.class));
            }
        }
    }

    return function;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.TypeAnnotationDeserializer.java

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

    final TypeAnnotation typeAnnot = new TypeAnnotation();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Term".equals(jp.getCurrentName())) {
                typeAnnot.setTerm(jp.nextTextValue());
            } else if ("Qualifier".equals(jp.getCurrentName())) {
                typeAnnot.setQualifier(jp.nextTextValue());
            } else if ("Documentation".equals(jp.getCurrentName())) {
                jp.nextToken();/* ww w .j  a  va2  s .  c  o  m*/
                typeAnnot.setDocumentation(jp.getCodec().readValue(jp, Documentation.class));
            } else if ("PropertyValue".equals(jp.getCurrentName())) {
                jp.nextToken();
                typeAnnot.getPropertyValues().add(jp.getCodec().readValue(jp, PropertyValue.class));
            }
        }
    }

    return typeAnnot;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.AssociationSetDeserializer.java

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

    final AssociationSet associationSet = new AssociationSet();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                associationSet.setName(jp.nextTextValue());
            } else if ("Association".equals(jp.getCurrentName())) {
                associationSet.setAssociation(jp.nextTextValue());
            } else if ("End".equals(jp.getCurrentName())) {
                jp.nextToken();/*from  www  .j  a  va2  s.co  m*/
                associationSet.getEnds().add(jp.getCodec().readValue(jp, AssociationSetEnd.class));
            }
        }
    }

    return associationSet;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.v4.TermDeserializer.java

@Override
protected Term doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    final Term term = new Term();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                term.setName(jp.nextTextValue());
            } else if ("Type".equals(jp.getCurrentName())) {
                term.setType(jp.nextTextValue());
            } else if ("BaseTerm".equals(jp.getCurrentName())) {
                term.setBaseTerm(jp.nextTextValue());
            } else if ("DefaultValue".equals(jp.getCurrentName())) {
                term.setDefaultValue(jp.nextTextValue());
            } else if ("Nullable".equals(jp.getCurrentName())) {
                term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("MaxLength".equals(jp.getCurrentName())) {
                term.setMaxLength(jp.nextTextValue());
            } else if ("Precision".equals(jp.getCurrentName())) {
                term.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
            } else if ("Scale".equals(jp.getCurrentName())) {
                term.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
            } else if ("SRID".equals(jp.getCurrentName())) {
                term.setSrid(jp.nextTextValue());
            } else if ("AppliesTo".equals(jp.getCurrentName())) {
                for (String split : StringUtils.split(jp.nextTextValue())) {
                    term.getAppliesTo().add(CSDLElement.valueOf(split));
                }//from  ww w  .j a  va  2 s. com
            } else if ("Annotation".equals(jp.getCurrentName())) {
                jp.nextToken();
                term.setAnnotation(jp.getCodec().readValue(jp, Annotation.class));
            }
        }
    }

    return term;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.FunctionImportDeserializer.java

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

    final FunctionImport funcImp = new FunctionImport();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                funcImp.setName(jp.nextTextValue());
            } else if ("ReturnType".equals(jp.getCurrentName())) {
                funcImp.setReturnType(jp.nextTextValue());
            } else if ("EntitySet".equals(jp.getCurrentName())) {
                funcImp.setEntitySet(jp.nextTextValue());
            } else if ("EntitySetPath".equals(jp.getCurrentName())) {
                funcImp.setEntitySetPath(jp.nextTextValue());
            } else if ("IsComposable".equals(jp.getCurrentName())) {
                funcImp.setComposable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsSideEffecting".equals(jp.getCurrentName())) {
                funcImp.setSideEffecting(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsBindable".equals(jp.getCurrentName())) {
                funcImp.setBindable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsAlwaysBindable".equals(jp.getCurrentName())) {
                funcImp.setAlwaysBindable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("HttpMethod".equals(jp.getCurrentName())) {
                funcImp.setHttpMethod(jp.nextTextValue());
            } else if ("Parameter".equals(jp.getCurrentName())) {
                jp.nextToken();//from w ww .  jav  a  2 s .c  o m
                funcImp.getParameters().add(jp.getCodec().readValue(jp, Parameter.class));
            }
        }
    }

    return funcImp;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.ReferentialConstraintRoleDeserializer.java

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

    final ReferentialConstraintRole refConstRole = new ReferentialConstraintRole();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Role".equals(jp.getCurrentName())) {
                refConstRole.setRole(jp.nextTextValue());
            } else if ("PropertyRef".equals(jp.getCurrentName())) {
                jp.nextToken();//  w w w .  j  a  v a 2s .co m
                refConstRole.getPropertyRefs().add(jp.getCodec().readValue(jp, PropertyRef.class));
            }
        }
    }

    return refConstRole;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.v3.FunctionImportDeserializer.java

@Override
protected FunctionImport doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    final FunctionImport funcImp = new FunctionImport();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                funcImp.setName(jp.nextTextValue());
            } else if ("ReturnType".equals(jp.getCurrentName())) {
                funcImp.setReturnType(jp.nextTextValue());
            } else if ("EntitySet".equals(jp.getCurrentName())) {
                funcImp.setEntitySet(jp.nextTextValue());
            } else if ("EntitySetPath".equals(jp.getCurrentName())) {
                funcImp.setEntitySetPath(jp.nextTextValue());
            } else if ("IsComposable".equals(jp.getCurrentName())) {
                funcImp.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("IsSideEffecting".equals(jp.getCurrentName())) {
                funcImp.setSideEffecting(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("IsBindable".equals(jp.getCurrentName())) {
                funcImp.setBindable(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("IsAlwaysBindable".equals(jp.getCurrentName())) {
                funcImp.setAlwaysBindable(BooleanUtils.toBoolean(jp.nextTextValue()));
            } else if ("HttpMethod".equals(jp.getCurrentName())) {
                funcImp.setHttpMethod(jp.nextTextValue());
            } else if ("Parameter".equals(jp.getCurrentName())) {
                jp.nextToken();/*www  . java  2 s .  c  o  m*/
                funcImp.getParameters().add(jp.getCodec().readValue(jp, Parameter.class));
            }
        }
    }

    return funcImp;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.DataServicesDeserializer.java

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

    final DataServices dataServices = new DataServices();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("DataServiceVersion".equals(jp.getCurrentName())) {
                dataServices.setDataServiceVersion(jp.nextTextValue());
            } else if ("MaxDataServiceVersion".equals(jp.getCurrentName())) {
                dataServices.setMaxDataServiceVersion(jp.nextTextValue());
            } else if ("Schema".equals(jp.getCurrentName())) {
                jp.nextToken();//  w ww .j  av a 2  s  . co  m
                dataServices.getSchemas().add(jp.getCodec().readValue(jp, Schema.class));
            }
        }
    }

    return dataServices;
}