|
From: Leandro R. S. C. <bas...@us...> - 2004-03-22 21:34:26
|
Update of /cvsroot/xingu/xingu/exintake/src/java/br/com/ibnetwork/xingu/exintake/model/rule/factory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31708/exintake/src/java/br/com/ibnetwork/xingu/exintake/model/rule/factory Added Files: RuleSetFactory.java RuleFactory.java Log Message: adding Extensible input taker --- NEW FILE: RuleSetFactory.java --- /* * Created on Jan 6, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package br.com.ibnetwork.xingu.exintake.model.rule.factory; import java.util.List; import br.com.ibnetwork.xingu.exintake.model.rule.impl.RuleSetDefaultImpl; import br.com.ibnetwork.xingu.factory.ObjectFactoryException; import br.com.ibnetwork.xingu.factory.impl.FactoryDefaultImpl; /** * @author <a href="mailto:le...@ib...">Leandro Rodrigo Saad Cruz</a> * */ public class RuleSetFactory extends FactoryDefaultImpl { /** * */ public RuleSetFactory() { super(); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see br.com.ibnetwork.xingu.factory.Factory#getInstance(java.lang.String, java.lang.Object[], java.lang.String[]) */ public Object getInstance( String className, Object[] params, String[] signature) throws ObjectFactoryException { String fieldName = (String) params[0]; List rules = (List) params[1]; return new RuleSetDefaultImpl(fieldName,rules); } } --- NEW FILE: RuleFactory.java --- /* * Created on Jan 6, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package br.com.ibnetwork.xingu.exintake.model.rule.factory; import org.xml.sax.Attributes; import br.com.ibnetwork.xingu.exintake.model.rule.impl.*; import br.com.ibnetwork.xingu.factory.ObjectFactoryException; import br.com.ibnetwork.xingu.factory.impl.FactoryDefaultImpl; /** * @author <a href="mailto:le...@ib...">Leandro Rodrigo Saad Cruz</a> * */ public class RuleFactory extends FactoryDefaultImpl { /** * */ public RuleFactory() { super(); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see br.com.ibnetwork.xingu.factory.Factory#getInstance(java.lang.String, java.lang.Object[], java.lang.String[]) */ public Object getInstance(String className,Object[] params,String[] signature) throws ObjectFactoryException { Attributes attrs = (Attributes) params[0]; String type = attrs.getValue("type"); String value = attrs.getValue("value"); if("mask".equalsIgnoreCase(type)) { return new MaskRule(value); } else if("required".equalsIgnoreCase(type)) { return new RequiredRule(value); } else if("format".equalsIgnoreCase(type)) { return new FormatRule(value); } else if("minLength".equalsIgnoreCase(type)) { return new MinLengthRule(value); } else if("maxLength".equalsIgnoreCase(type)) { return new MaxLengthRule(value); } throw new ObjectFactoryException("This rule type ["+type +"] doesn?t exists"); } } |