Skip to content

http://groups.google.com/group/google-gson/t/677d56e9976d7761 #37

@GoogleCodeExporter

Description

@GoogleCodeExporter
Hi, guys!

I was thinking of the problem and have concluded, that the solution of the
issue (see link
http://groups.google.com/group/google-gson/t/677d56e9976d7761):
JsonObjectDeserializationVisitor should check if there is custom
deserializer registered for specified type and not create instance by.

  Something like this:

  @SuppressWarnings("unchecked")
  JsonObjectDeserializationVisitor(JsonElement json, Type type,
      ObjectNavigatorFactory factory, ObjectConstructor objectConstructor,
      TypeAdapter typeAdapter,
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,
      JsonDeserializationContext context) {
    super(json, factory, objectConstructor, typeAdapter, deserializers,
context);
    JsonDeserializer deserialezer;
    if ((deserialezer = deserializers.getHandlerFor(type)) != null) {
      this.target = deserialezer.deserialize(json, type, context);
    } else {
      this.target = (T) objectConstructor.construct(type);
    }
  }


Original issue reported on code.google.com by [email protected] on 27 Aug 2008 at 7:57

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions