Package org.codehaus.jackson.map.module

Examples of org.codehaus.jackson.map.module.SimpleModule


  public static Module build() {

    Version version = new Version(1, 0, 0, null);

    SimpleModule module = new SimpleModule("values", version);

    //

    Class<DecimalValue> klazDecimal = DecimalValue.class;
    module.addSerializer(new DecimalValueSer(klazDecimal));
    module.addDeserializer(klazDecimal, new DecimalValueDes(klazDecimal));

    //

    Class<PriceValue> klazPrice = PriceValue.class;
    module.addSerializer(new PriceValueSer(klazPrice));
    module.addDeserializer(klazPrice, new PriceValueDes(klazPrice));

    //

    Class<SizeValue> klazSize = SizeValue.class;
    module.addSerializer(new SizeValueSer(klazSize));
    module.addDeserializer(klazSize, new SizeValueDes(klazSize));

    //

    Class<TextValue> klazText = TextValue.class;
    module.addSerializer(new TextValueSer(klazText));
    module.addDeserializer(klazText, new TextValueDes(klazText));

    //

    Class<TimeValue> klazTime = TimeValue.class;
    module.addSerializer(new TimeValueSer(klazTime));
    module.addDeserializer(klazTime, new TimeValueDes(klazTime));

    //

    return module;
View Full Code Here


        }

        // Create a standard Jackson mapper object
        ObjectMapper mapper = new ObjectMapper();

        SimpleModule module = new SimpleModule("CleverModule", Version.unknownVersion());
        module.addDeserializer(District.class, new DistrictDeserializer());
        module.addDeserializer(School.class, new SchoolDeserializer());
        module.addDeserializer(Teacher.class, new TeacherDeserializer());
        module.addDeserializer(Student.class, new StudentDeserializer());

        mapper.registerModule(module);

        T parsedResponse = parseJson(mapper, httpResponse);
View Full Code Here

      _deserializers = new STJSDeserializers();
    }
  }

  public static Module getModule() {
    SimpleModule module = new STJSSimpleModule("MyModule", new Version(1, 0, 0, null));
    module.addSerializer(new JSArraySerializer());
    module.addSerializer(new JSMapSerializer());
    module.addSerializer(new JSDateSerializer());
    module.addDeserializer(Date.class, new JSDateDeserializer());
    return module;
  }
View Full Code Here

  public CustomObjectMapper() {
    super.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
    setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
    configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
    SimpleModule simpleModule = new SimpleModule("SimpleModule",
        new Version(1, 0, 0, null));

    simpleModule.addSerializer(new ContactSerializer());
    simpleModule.addSerializer(new StructuredValueSerializer());
    simpleModule.addSerializer(new TextListSerializer());
    simpleModule.addSerializer(new TextSerializer());
    simpleModule.addSerializer(new URIValueSerializer());
    simpleModule.addSerializer(new DomainNameSerializer());
    simpleModule.addSerializer(new DateTimeSerializer());
    simpleModule.addSerializer(new StatusSerializer());
    for (JsonSerializer serializer: getSerializers()) {
      simpleModule.addSerializer(serializer);
    }

    simpleModule.addDeserializer(Contact.class, new ContactDeserializer());
    simpleModule.addDeserializer(DomainName.class, new DomainNameDeserializer());
    simpleModule.addDeserializer(Entity.Role.class, new RoleDeserializer());
    simpleModule.addDeserializer(DateTime.class, new DateTimeDeserializer());
    simpleModule.addDeserializer(Event.Action.class, new ActionDeserializer());
    simpleModule.addDeserializer(Status.class, new StatusDeserializer());
    simpleModule.addDeserializer(Domain.Variant.Relation.class, new RelationDeserializer());

    registerModule(simpleModule);
  }
View Full Code Here

  public static Module build() {

    Version version = new Version(1, 0, 0, null);

    SimpleModule module = new SimpleModule("values", version);

    //

    Class<DecimalValue> klazDecimal = DecimalValue.class;
    module.addSerializer(new DecimalValueSer(klazDecimal));
    module.addDeserializer(klazDecimal, new DecimalValueDes(klazDecimal));

    //

    Class<PriceValue> klazPrice = PriceValue.class;
    module.addSerializer(new PriceValueSer(klazPrice));
    module.addDeserializer(klazPrice, new PriceValueDes(klazPrice));

    //

    Class<SizeValue> klazSize = SizeValue.class;
    module.addSerializer(new SizeValueSer(klazSize));
    module.addDeserializer(klazSize, new SizeValueDes(klazSize));

    //

    Class<TextValue> klazText = TextValue.class;
    module.addSerializer(new TextValueSer(klazText));
    module.addDeserializer(klazText, new TextValueDes(klazText));

    //

    Class<TimeValue> klazTime = TimeValue.class;
    module.addSerializer(new TimeValueSer(klazTime));
    module.addDeserializer(klazTime, new TimeValueDes(klazTime));

    //

    return module;
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.module.SimpleModule

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.