コード例 #1
0
  @Override
  protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException {
    if (options == null) {
      options = Collections.<String, Object>emptyMap();
    }

    if (inputStream instanceof URIConverter.Loadable) {

      ((URIConverter.Loadable) inputStream).loadResource(this);

    } else {

      final ObjectMapper mapper = new ObjectMapper();
      final JacksonOptions jacksonOptions = getOptions(options);
      mapper.setDateFormat(jacksonOptions.dateFormat);
      mapper.registerModule(new EMFModule(this.getResourceSet(), jacksonOptions));

      ContextAttributes attributes =
          ContextAttributes.getEmpty().withSharedAttribute("resource", this);

      mapper.reader().with(attributes).forType(Resource.class).readValue(inputStream);
    }
  }
コード例 #2
0
 @Override
 public SerializerProvider setAttribute(Object key, Object value) {
   _attributes = _attributes.withPerCallAttribute(key, value);
   return this;
 }
コード例 #3
0
 @Override
 public Object getAttribute(Object key) {
   return _attributes.getAttribute(key);
 }