[Csvtosql-cvs] csvtosql_jdk50/src/net/sf/csv2sql/configuration/sections TableStructure.java,NONE,1.1
Brought to you by:
davideconsonni
|
From: consonni d. <dav...@us...> - 2005-04-25 10:53:26
|
Update of /cvsroot/csvtosql/csvtosql_jdk50/src/net/sf/csv2sql/configuration/sections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15138/net/sf/csv2sql/configuration/sections Added Files: TableStructure.java WriterList.java Log Message: no message --- NEW FILE: TableStructure.java --- /* Copyright (C) 2004 Davide Consonni <dco...@en...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.sf.csv2sql.configuration.sections; import java.util.List; import java.util.ArrayList; import net.sf.csv2sql.grammars.AbstractField; /** * Utility class for rappresenting a real database table. * <p> * contain the name of the table passed in the constructor * (can be retrived with the <code>getTableName()</code> getter) and * the list of the field (identified by a list of <code>AbstractField</code> class). * <p> * field can be add by the <code>addField()</code> method. * @author <a href="mailto:dco...@en...">Davide Consonni</a> */ public final class TableStructure { private String tableName; private List<AbstractField> fields = new ArrayList<AbstractField>(); public TableStructure(String tableName) throws IllegalArgumentException { if (tableName==null || "".equals(tableName)) { throw new IllegalArgumentException("no table name specified."); } this.tableName = tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public String getTableName() { return this.tableName; } public List getFields() { return this.fields; } public void addField(AbstractField field) throws IllegalArgumentException { if (field==null) { throw new IllegalArgumentException("field can't be null."); } fields.add(field); } } --- NEW FILE: WriterList.java --- /* Copyright (C) 2004 Davide Consonni <dco...@en...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.sf.csv2sql.configuration.sections; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import net.sf.csv2sql.writers.AbstractWriter; /** * Utility class that use decorator to implement * an object with accept only <code>AbstractWriter</code> * and permits to iterate on added writer. * @author <a href="mailto:dco...@en...">Davide Consonni</a> */ public class WriterList { private List<AbstractWriter> writers = new ArrayList<AbstractWriter>(); public void addWriter(AbstractWriter writer) throws IllegalArgumentException { if (writer==null) { throw new IllegalArgumentException("writer can't be null."); } this.writers.add(writer); } public Iterator<AbstractWriter> iterator() { return writers.iterator(); } } |