List of usage examples for com.fasterxml.jackson.core JsonToken END_OBJECT
JsonToken END_OBJECT
To view the source code for com.fasterxml.jackson.core JsonToken END_OBJECT.
Click Source Link
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();// w w w .j a va2 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.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();// w w w .j a v a 2 s . co 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:javaslang.jackson.datatype.deserialize.MapDeserializer.java
@Override public Map<?, ?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { final java.util.List<Tuple2<Object, Object>> result = new java.util.ArrayList<>(); while (p.nextToken() != JsonToken.END_OBJECT) { String name = p.getCurrentName(); Object key = keyDeserializer.deserializeKey(name, ctxt); p.nextToken();//from w ww .j av a 2s . c om result.add(Tuple.of(key, valueDeserializer.deserialize(p, ctxt))); } if (TreeMap.class.isAssignableFrom(handledType())) { return TreeMap.ofEntries(keyComparator, result); } if (LinkedHashMap.class.isAssignableFrom(handledType())) { return LinkedHashMap.ofEntries(result); } // default deserialization [...] -> Map return HashMap.ofEntries(result); }
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();//from w w w . ja va 2 s. com funcImp.getParameters().add(jp.getCodec().readValue(jp, Parameter.class)); } } } return funcImp; }
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 w w w.j ava 2 s . c o m*/ } 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.v4.NavigationPropertyDeserializer.java
@Override protected NavigationProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final NavigationProperty property = new NavigationProperty(); for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { final JsonToken token = jp.getCurrentToken(); if (token == JsonToken.FIELD_NAME) { if ("Name".equals(jp.getCurrentName())) { property.setName(jp.nextTextValue()); } else if ("Type".equals(jp.getCurrentName())) { property.setType(jp.nextTextValue()); } else if ("Nullable".equals(jp.getCurrentName())) { property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue())); } else if ("Partner".equals(jp.getCurrentName())) { property.setPartner(jp.nextTextValue()); } else if ("ContainsTarget".equals(jp.getCurrentName())) { property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue())); } else if ("ReferentialConstraint".equals(jp.getCurrentName())) { jp.nextToken();/*ww w . j ava 2 s. c o m*/ property.getReferentialConstraints() .add(jp.getCodec().readValue(jp, ReferentialConstraint.class)); } else if ("OnDelete".equals(jp.getCurrentName())) { jp.nextToken(); property.setOnDelete(jp.getCodec().readValue(jp, OnDelete.class)); } else if ("Annotation".equals(jp.getCurrentName())) { jp.nextToken(); property.setAnnotation(jp.getCodec().readValue(jp, Annotation.class)); } } } return property; }
From source file:org.emfjson.jackson.databind.deser.EMapDeserializer.java
@Override @SuppressWarnings("unchecked") public EList<Map.Entry<?, ?>> deserialize(JsonParser jp, DeserializationContext ctxt, EList<Map.Entry<?, ?>> intoValue) throws IOException { final EReference reference = EMFContext.getReference(ctxt); if (jp.getCurrentToken() == JsonToken.START_OBJECT) { while (jp.nextToken() != JsonToken.END_OBJECT) { final String key = jp.getCurrentName(); jp.nextToken();/* ww w.j a v a 2 s . c o m*/ final Object value; if (jp.getCurrentToken() == JsonToken.START_OBJECT) { value = ctxt.readValue(jp, EObject.class); } else { value = ctxt.readValue(jp, Object.class); } // Dynamic objects do not use the EMap interface // but store entries in a DynamicEList instead. if (intoValue instanceof EMap) { ((EMap) intoValue).put(key, value); } else if (reference != null) { intoValue .add((Map.Entry<?, ?>) EObjects.createEntry(key, value, reference.getEReferenceType())); } } } return intoValue; }