1 /* 2 * JaspertReports JSF Plugin Copyright (C) 2011 A. Alonso Dominguez 3 * 4 * This library is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation; either version 2.1 of the License, or (at 7 * your option) any later version. This library is distributed in the hope 8 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 * 11 * See the GNU Lesser General Public License for more details. You should have 12 * received a copy of the GNU Lesser General Public License along with this 13 * library; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * Place, Suite 330, Boston, MA 02111-1307 USA A. 15 * 16 * Alonso Dominguez 17 * alonsoft@users.sf.net 18 */ 19 package net.sf.jasperreports.jsf.convert; 20 21 import java.io.Serializable; 22 import javax.faces.component.UIComponent; 23 import javax.faces.context.FacesContext; 24 25 import net.sf.jasperreports.jsf.engine.Source; 26 27 /** 28 * Source converter interface. 29 * 30 * @author A. Alonso Dominguez 31 */ 32 public interface SourceConverter extends Serializable { 33 34 /** 35 * Obtains a <tt>Source</tt> instance from the value 36 * obtained as a parameter. 37 * 38 * @param context current faces' context. 39 * @param component faces' component asking for conversion. 40 * @param value the value that must be converted. 41 * @return a <tt>Source</tt> 42 * @throws ConverterException if value can't be converted. 43 */ 44 public Source convertFromValue(FacesContext context, 45 UIComponent component, Object value) 46 throws ConverterException; 47 48 /** 49 * Converts the received source into its original form. 50 * 51 * @param context current faces' context. 52 * @param component faces' component asking for conversion. 53 * @param source the source instance. 54 * @return a original source value. 55 * @throws ConverterException if source can't be converted. 56 */ 57 public Object convertFromSource(FacesContext context, 58 UIComponent component, Source source) 59 throws ConverterException; 60 61 }