Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.ObjectCodec


        String classField = pluginMap.classField();
        JsonToken currentToken = jp.getCurrentToken();
        // can use this to approximate error location if a sub-method throws an exception
        JsonLocation currentLocation = jp.getTokenLocation();
        JsonNode jsonNode = jp.readValueAsTree();
        ObjectCodec objectCodec = jp.getCodec();

        try {
            Object bean = null;
            // _array handler
            if (jsonNode.isArray()) {
View Full Code Here


    public static class Deserializer extends JsonDeserializer<IntOrString> {

        @Override
        public IntOrString deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            ObjectCodec oc = jsonParser.getCodec();
            JsonNode node = oc.readTree(jsonParser);
            IntOrString intOrString = new IntOrString();
            int asInt = node.asInt();
            if (asInt != 0) {
                intOrString.setIntValue(asInt);
            } else {
View Full Code Here

public class RestLoaderRequestDeserializer extends JsonDeserializer<RestLoaderRequest<IEntity>> {

    @Override
    public RestLoaderRequest<IEntity> deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
        try {
            final ObjectCodec objectCodec = jp.getCodec();
            final JsonNode node = objectCodec.readTree(jp);
            final String className = node.get("className").textValue();
            final String fieldName = node.get("fieldName").textValue();

            final Class<?> clazz = Class.forName(className);
View Full Code Here

    @Override
    public Localized<Object> deserialize(final JsonParser parser,
                                         final DeserializationContext context)
            throws IOException {
        final LocalizedBuilder<Object> builder = new LocalizedBuilder<Object>();
        final ObjectCodec codec = parser.getCodec();
        final JsonNode node = codec.readTree(parser);
        final Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
        while (iterator.hasNext()) {
            final Map.Entry<String, JsonNode> entry = iterator.next();
            builder.setValue(
                    Locale.forLanguageTag(entry.getKey()),
View Full Code Here

    public static class Deserializer extends JsonDeserializer<Ports> {
        @Override
        public Ports deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

            Ports out = new Ports();
            ObjectCodec oc = jsonParser.getCodec();
            JsonNode node = oc.readTree(jsonParser);
            for (Iterator<Map.Entry<String, JsonNode>> it = node.fields(); it.hasNext();) {

                Map.Entry<String, JsonNode> field = it.next();
                if (!field.getValue().equals(NullNode.getInstance())) {
                    String hostIp = field.getValue().get(0).get("HostIp").textValue();
View Full Code Here

  }
 
  @Override
  protected BsonParser _createParser(InputStream in, IOContext ctxt) {
    BsonParser p = new BsonParser(ctxt, _parserFeatures, _bsonParserFeatures, in);
    ObjectCodec codec = getCodec();
    if (codec != null) {
      p.setCodec(codec);
    }
    return p;
  }
View Full Code Here

    ctxt.setEncoding(enc);
    if (enc == JsonEncoding.UTF8 && _outputDecorator != null) {
      out = _outputDecorator.decorate(ctxt, out);
    }
    BsonGenerator g = new BsonGenerator(_generatorFeatures, _bsonGeneratorFeatures, out);
      ObjectCodec codec = getCodec();
      if (codec != null) {
        g.setCodec(codec);
      }
      return g;
  }
View Full Code Here

   * Fully reads an embedded document, reusing this parser
   * @return the parsed document
   * @throws IOException if the document could not be read
   */
  protected Map<String, Object> readDocument() throws IOException {
    ObjectCodec codec = getCodec();
    if (codec == null) {
      throw new IllegalStateException("Could not parse embedded document " +
          "because BSON parser has no codec");
    }
    _currToken = handleNewDocument(false);
    return codec.readValue(this, new TypeReference<Map<String, Object>>() {});
  }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.ObjectCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.