Coder Social home page Coder Social logo

ottogroup / jackson-datatype-ecore Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 214 KB

Jackson module to support JSON serialization and deserialization of Eclipse Ecore data types.

License: Other

Starlark 12.72% Makefile 0.28% Shell 1.30% Java 85.69%

jackson-datatype-ecore's Introduction

jackson-datatype-ecore

Jackson module to support JSON serialization and deserialization of Eclipse Ecore data types.

Usage

Using the Resource API

// Using the global package registry
var resourceSet = new ResourceSetImpl();
var factory = new JsonResourceFactory(resourceSet.getPackageRegistry());
resourceSet
    .getResourceFactoryRegistry()
    .getExtensionToFactoryMap()
    .put("json",factory);

// Reading
var resource = resourceSet.getResource(URI.createURI("some/file.json"), true);
var head = resource.getContents().get(0);

// Writing
EObject obj = ...
resource.getContents().add(obj);
resource.save(null);

Using the ObjectMapper API

// Using the global package registry
var mapper = new EcoreMapper();

EObject obj = mapper.readValue(new File("some/file.json"));
String json = mapper.writeValueAsString(obj);

Limitations

  • Containment proxies will never be serialized as a reference but as the actual object instead

Development

This project is built with Bazel.

You can use the Bazel plugin for IntelliJ. After opening the project in IntelliJ, you can import the default settings configured in .bazelproject by putting this line in your <WORKSPACE>/.ijwb/.bazelproject file:

import .bazelproject

After syncing, the dependent libraries should be synced. Furthermore, the test cases should show up as run configurations.

Please have a look at the Makefile for some common tasks like formatting and testing the code.

Managing dependencies

External dependencies are configured using bzlmod. External Maven dependencies are managed using rules_jvm_external. You can find the configuration in MODULE.bazel.

When updating Maven dependencies, make sure to update the lock file using make pin for the changes to take effect.

Outdated Maven dependencies can be listed using make outdated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.