Package com.ecwid.mailchimp

Examples of com.ecwid.mailchimp.MailChimpObject$ReflectiveKeyIterator


    if (in.peek() == JsonToken.NULL) {
      in.nextNull();
      return null;
    }

    MailChimpObject result;
    try {
      result = constructor.newInstance();
    } catch(Exception e) {
      throw new RuntimeException("Failed to invoke " + constructor + " with no args", e);
    }

    in.beginObject();
    while (in.hasNext()) {
      final String key;
      if (in.peek() == JsonToken.NAME) {
        key = in.nextName();
      } else {
        key = in.nextString();
      }

      final Object value;
     
      Type valueType = result.getReflectiveMappingTypes().get(key);
      if (valueType != null) {
        value = gson.getAdapter(TypeToken.get(valueType)).read(in);
      } else {
        if (in.peek() == JsonToken.BEGIN_OBJECT) {
          value = gson.getAdapter(MailChimpObject.class).read(in);
        } else if(in.peek() == JsonToken.BEGIN_ARRAY) {
          value = readList(in);
        } else {
          value = gson.getAdapter(Object.class).read(in);
        }
      }

      if (result.put(key, value) != null) {
        throw new JsonSyntaxException("duplicate key: " + key);
      }
    }
    in.endObject();
View Full Code Here

TOP

Related Classes of com.ecwid.mailchimp.MailChimpObject$ReflectiveKeyIterator

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.