/** * Create a Resource using data from the given object for the requested content type. * * @param object the object to use as a source of properties (data). * @param contentType the content type to use when creating the new resource. * @return a concrete implementation of Resource with properties copied from object. * @throws ResourceException if no factory exists for the contentType */ @Override public Resource createResource(Object object, String contentType) { ResourceFactoryStrategy strategy = factoryStrategies.get(contentType); if (strategy == null) { throw new ResourceException("Cannot create resource for content type: " + contentType); } return strategy.createResource(object); }