Example usage for com.fasterxml.jackson.core Version Version

List of usage examples for com.fasterxml.jackson.core Version Version

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core Version Version.

Prototype

public Version(int major, int minor, int patchLevel, String snapshotInfo, String groupId, String artifactId) 

Source Link

Usage

From source file:de.escalon.hypermedia.spring.hydra.JacksonHydraModule.java

public JacksonHydraModule(ProxyUnwrapper proxyUnwrapper) {
    super("json-hydra-module", new Version(1, 0, 0, null, "de.escalon.hypermedia", "hydra-spring"));
    this.proxyUnwrapper = proxyUnwrapper;
    setMixInAnnotation(ResourceSupport.class, ResourceSupportMixin.class);
    setMixInAnnotation(Resources.class, ResourcesMixin.class);
    setMixInAnnotation(PagedResources.class, PagedResourcesMixin.class);
    setMixInAnnotation(Resource.class, ResourceMixin.class);
    setMixInAnnotation(TypedResource.class, TypedResourceMixin.class);
    addSerializer(Resource.class, new ResourceSerializer());
    addSerializer(PagedResources.class, new PagedResourcesSerializer(proxyUnwrapper));

}

From source file:fr.norad.jmxzabbix.core.ZabbixClient.java

public ZabbixClient(ZabbixConfig config) {
    this.config = config;

    // zabbix does not understand boolean with value true without quotes which is default of jackson
    SimpleModule module = new SimpleModule("BooleanAsString", new Version(1, 0, 0, null, null, null));
    module.addSerializer(new NonTypedScalarSerializerBase<Boolean>(Boolean.class) {
        @Override/*from w ww .java2 s.c  o  m*/
        public void serialize(Boolean value, JsonGenerator jgen, SerializerProvider provider)
                throws IOException {
            jgen.writeString(value.toString());
        }
    });

    mapper.registerModule(module);
}

From source file:de.ks.flatadocdb.defaults.json.SerializationModule.java

@Override
public Version version() {
    return new Version(1, 0, 0, "none", null, null);
}

From source file:com.meltmedia.jackson.crypto.CryptoModule.java

@Override
public Version version() {
    String[] versionInfo = MavenProperties.VERSION.split("[\\.-]", 4);
    if (versionInfo.length < 3) {
        return Version.unknownVersion();
    }//from   ww  w.j a  v  a  2  s  .c  om
    try {
        int major = Integer.valueOf(versionInfo[0]);
        int minor = Integer.valueOf(versionInfo[1]);
        int patch = Integer.valueOf(versionInfo[2]);
        String snapshotInfo = versionInfo.length == 3 ? null : versionInfo[3];
        return new Version(major, minor, patch, snapshotInfo, MavenProperties.GROUP_ID,
                MavenProperties.ARTIFACT_ID);
    } catch (Exception e) {
        return Version.unknownVersion();
    }
}

From source file:org.dbrain.data.jackson.modules.StandardModule.java

@Override
public Version version() {
    return new Version(1, 0, 0, "", "", "");
}

From source file:com.mastfrog.jackson.OptionalSerializer.java

@Override
public ObjectMapper configure(ObjectMapper mapper) {
    SimpleModule sm = new SimpleModule("optional", new Version(1, 0, 0, null, "com.mastfrog", "jackson"));
    sm.addSerializer(new OptionalSer());
    sm.addSerializer(new ReflectionOptionalSerializer());
    mapper.registerModule(sm);/*from w ww .j a  v a2  s.c o  m*/
    return mapper;
}

From source file:org.jongo.marshall.jackson.JacksonProcessor.java

public static ObjectMapper createPreConfiguredMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(AUTO_DETECT_GETTERS, false);
    mapper.configure(AUTO_DETECT_SETTERS, false);
    mapper.setSerializationInclusion(NON_NULL);
    mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(ANY));

    SimpleModule module = new SimpleModule("jongo", new Version(1, 0, 0, null, null, null));
    addBSONTypeSerializers(module);//w w  w .j  a  v  a  2 s . c o m
    mapper.registerModule(module);
    return mapper;
}

From source file:org.mango.marshall.jackson.JacksonProcessor.java

public static ObjectMapper createPreConfiguredMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(AUTO_DETECT_GETTERS, false);
    mapper.configure(AUTO_DETECT_SETTERS, false);
    mapper.setSerializationInclusion(NON_NULL);
    mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(ANY));

    SimpleModule module = new SimpleModule("mango", new Version(1, 0, 0, null, null, null));
    addBSONTypeSerializers(module);/*ww  w. j av a 2s  .  c  om*/
    mapper.registerModule(module);
    return mapper;
}

From source file:com.ning.billing.recurly.model.RecurlyObject.java

public static XmlMapper newXmlMapper() {
    final XmlMapper xmlMapper = new XmlMapper();
    xmlMapper.setSerializerProvider(new RecurlyXmlSerializerProvider());
    final AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
    final AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
    final AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
    xmlMapper.setAnnotationIntrospector(pair);
    xmlMapper.registerModule(new JodaModule());
    xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

    final SimpleModule m = new SimpleModule("module", new Version(1, 0, 0, null, null, null));
    m.addSerializer(Accounts.class, new RecurlyObjectsSerializer<Accounts, Account>(Accounts.class, "account"));
    m.addSerializer(AddOns.class, new RecurlyObjectsSerializer<AddOns, AddOn>(AddOns.class, "add_on"));
    m.addSerializer(Adjustments.class,
            new RecurlyObjectsSerializer<Adjustments, Adjustment>(Adjustments.class, "adjustment"));
    m.addSerializer(Coupons.class, new RecurlyObjectsSerializer<Coupons, Coupon>(Coupons.class, "coupon"));
    m.addSerializer(Invoices.class, new RecurlyObjectsSerializer<Invoices, Invoice>(Invoices.class, "invoice"));
    m.addSerializer(Plans.class, new RecurlyObjectsSerializer<Plans, Plan>(Plans.class, "plan"));
    m.addSerializer(RecurlyErrors.class,
            new RecurlyObjectsSerializer<RecurlyErrors, RecurlyError>(RecurlyErrors.class, "error"));
    m.addSerializer(SubscriptionAddOns.class,
            new RecurlyObjectsSerializer<SubscriptionAddOns, SubscriptionAddOn>(SubscriptionAddOns.class,
                    "subscription_add_on"));
    m.addSerializer(Subscriptions.class,
            new RecurlyObjectsSerializer<Subscriptions, Subscription>(Subscriptions.class, "subscription"));
    m.addSerializer(Transactions.class,
            new RecurlyObjectsSerializer<Transactions, Transaction>(Transactions.class, "transaction"));
    xmlMapper.registerModule(m);/* w w w .  jav  a 2  s. com*/

    return xmlMapper;
}

From source file:org.craftercms.social.util.serialization.UGCObjectMapper.java

protected void registerSerializationModule() {
    SimpleModule module = new SimpleModule("UGCSerializationModule", new Version(1, 0, 0, null, null, null));

    for (JsonSerializer ser : serializerList) {
        module.addSerializer(ser);/*  w  w w .  jav  a  2 s. c om*/
    }

    for (Class key : deserializerMap.keySet()) {
        JsonDeserializer deser = deserializerMap.get(key);
        module.addDeserializer(key, deser);
    }

    registerModule(module);

}