UnquotedFieldAssembler.java

  1. /*
  2.  *
  3.  * The DbUnit Database Testing Framework
  4.  * Copyright (C)2002-2004, DbUnit.org
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2.1 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the Free Software
  18.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  *
  20.  */

  21. package org.dbunit.dataset.common.handlers;

  22. import java.util.LinkedList;

  23. import org.slf4j.Logger;
  24. import org.slf4j.LoggerFactory;


  25. /**
  26.  * @author fede
  27.  * @author Last changed by: $Author$
  28.  * @version $Revision$ $Date$
  29.  * @since 2.2 (Sep 12, 2004)
  30.  */
  31. public class UnquotedFieldAssembler extends AbstractPipelineComponent {

  32.     /**
  33.      * Logger for this class
  34.      */
  35.     private static final Logger logger = LoggerFactory.getLogger(UnquotedFieldAssembler.class);

  36.     LinkedList addedComponents;

  37.     public UnquotedFieldAssembler() {
  38.         setAddedComponents(new LinkedList());
  39.         getPipeline().putFront(SeparatorHandler.ENDPIECE());
  40.         getPipeline().putFront(IsAlnumHandler.QUOTE());
  41.         getPipeline().putFront(WhitespacesHandler.IGNORE());
  42.     }

  43. //    private LinkedList getAddedComponents() {
  44. //        logger.debug("getAddedComponents() - start");
  45. //
  46. //        return addedComponents;
  47. //    }

  48.     private void setAddedComponents(LinkedList addedComponents) {
  49.         logger.debug("setAddedComponents(addedComponents={}) - start", addedComponents);

  50.         this.addedComponents = addedComponents;
  51.     }

  52.     public boolean canHandle(char c) throws IllegalInputCharacterException {
  53.         if(logger.isDebugEnabled())
  54.             logger.debug("canHandle(c={}) - start", String.valueOf(c));

  55.         return true;
  56.     }

  57.     static protected class ASSEMBLE extends Helper {

  58.         /**
  59.          * Logger for this class
  60.          */
  61.         private static final Logger logger = LoggerFactory.getLogger(ASSEMBLE.class);

  62.         void helpWith(char c) {
  63.             if(logger.isDebugEnabled())
  64.                 logger.debug("helpWith(c={}) - start", String.valueOf(c));

  65.             getHandler().getPipeline().thePieceIsDone();
  66.         }
  67.     }

  68. }