/** * Copyright (C) 2008-2010, Squale Project - http://www.squale.org * * This file is part of Squale. * * Squale is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or any later version. * * Squale is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Squale. If not, see <http://www.gnu.org/licenses/>. */ package org.squale.squaleweb.transformer; import java.util.ArrayList; import org.squale.squaleweb.applicationlayer.formbean.component.SetOfErrorsListForm; import org.squale.welcom.struts.bean.WActionForm; import org.squale.welcom.struts.transformer.WITransformer; import org.squale.welcom.struts.transformer.WTransformerException; /** */ public class SetOfErrorsListTransformer implements WITransformer { /** * @param pObject l'objet � transformer * @throws WTransformerException si un pb apparait. * @return le formulaire. */ public WActionForm objToForm( Object[] pObject ) throws WTransformerException { SetOfErrorsListForm form = new SetOfErrorsListForm(); objToForm( pObject, form ); return form; } /** * @param pObject l'objet � transformer * @param pForm le formulaire � remplir. * @throws WTransformerException si un pb apparait. */ public void objToForm( Object[] pObject, WActionForm pForm ) throws WTransformerException { SetOfErrorsListForm form = (SetOfErrorsListForm) pForm; form.setSetOfErrors( (ArrayList) pObject[0] ); } // il n'est pas n�c�ssaire de surcharger les autres m�thodes // mais on lance une exception (code d�fensif) pour signaler // qu'il ne faut pas les utiliser /** * @param pForm le formulaire � remplir. * @throws WTransformerException car on ne peut pas l'appeler * @return plus rien car ne doit pas etre appel�e */ public Object[] formToObj( WActionForm pForm ) throws WTransformerException { throw new WTransformerException(); } /** * @param pObject l'objet � transformer * @param pForm le formulaire � remplir. * @throws WTransformerException car on ne peut pas l'appeler */ public void formToObj( WActionForm pForm, Object[] pObject ) throws WTransformerException { throw new WTransformerException(); } }