emfjson / emfjson-jackson

JSON Binding for Eclipse Modeling Framework
https://emfjson.github.io
Other
80 stars 23 forks source link

Provide access to the associated ObjectMapper in JsonResource via default load/save options #96

Open kchobantonov opened 7 years ago

kchobantonov commented 7 years ago

When combined with EMF mongo project we do need an access to the object mapper associated with the JsonResource so that we can use the predefined ObjectMapper in MongoInputStream/MongoOutputStream instead of creating new ObjectMapper via EMFModule.setupDefaultMapper();

Possible implementation

 ```
  public JsonResource(URI uri, ObjectMapper mapper) {
    super(uri);
    this.mapper = mapper;

    defaultLoadOptions = new HashMap<Object, Object>();
    defaultSaveOptions = new HashMap<Object, Object>();

    defaultLoadOptions.put(ObjectMapper.class.getName(), mapper);
    defaultSaveOptions.put(ObjectMapper.class.getName(), mapper);
}