001/*
002 *  jDTAUS Banking RI DTAUS
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.banking.dtaus.ri.zka;
022
023import java.util.HashMap;
024import java.util.Map;
025
026/**
027 * Gathers configuration of the file format implementations.
028 *
029 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
030 * @version $JDTAUS: Configuration.java 8661 2012-09-27 11:29:58Z schulte $
031 */
032public class Configuration
033{
034
035    /**
036     * Map of field constants to a flag indicating if space characters are allowed for a field.
037     * @serial
038     */
039    private Map spacesMap;
040
041    /**
042     * Gets a flag indicating if space characters are allowed for a given field.
043     *
044     * @param field constant for the field to query.
045     *
046     * @return {@code true} if space characters are allowed for field {@code field}; {@code false} if not.
047     */
048    public boolean isSpaceCharacterAllowed( final int field )
049    {
050        if ( this.spacesMap == null )
051        {
052            this.spacesMap = new HashMap();
053        }
054
055        final Boolean b = (Boolean) this.spacesMap.get( new Integer( field ) );
056        return b != null && b.booleanValue();
057    }
058
059    /**
060     * Sets a flag indicating that space characters are allowed for a given field.
061     *
062     * @param field constant for the field to set.
063     * @param spaceCharacterAllowed {@code true} if space characters are allowed for field {@code field};
064     * {@code false} if not.
065     */
066    public void setSpaceCharacterAllowed( final int field, final boolean spaceCharacterAllowed )
067    {
068        if ( this.spacesMap == null )
069        {
070            this.spacesMap = new HashMap();
071        }
072
073        this.spacesMap.put( new Integer( field ), Boolean.valueOf( spaceCharacterAllowed ) );
074    }
075
076}