001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nicolas Chapurlat <nchapurlat@nuxeo.com> 016 */ 017 018package org.nuxeo.ecm.core.io.registry; 019 020import java.io.IOException; 021import java.io.OutputStream; 022import java.lang.reflect.Type; 023 024import javax.ws.rs.core.MediaType; 025 026/** 027 * Interface of Java type to mimetype converter. 028 * <p> 029 * see {@link Marshaller} for more details. 030 * </p> 031 * 032 * @param <EntityType> The managed Java type. 033 * @since 7.2 034 */ 035public interface Writer<EntityType> extends Marshaller<EntityType> { 036 037 /** 038 * Writes the entity to out {@link OutputStream} using mediatype format. 039 * <p> 040 * This method implementation can use injected properties. 041 * </p> 042 * 043 * @param entity The entity to marshall. 044 * @param clazz The requested marshalled class. 045 * @param genericType The requested marshalled generic type. 046 * @param mediatype The target mediatype. 047 * @param out The output of this marshaller. 048 * @throws IOException If some error append while writing entity to out. 049 * @since 7.2 050 */ 051 public void write(EntityType entity, Class<?> clazz, Type genericType, MediaType mediatype, OutputStream out) 052 throws IOException; 053 054}