001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     * http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    package org.apache.commons.csv.writer;
020    
021    
022    /**
023     * @author Martin van den Bemt
024     * @version $Id: $
025     */
026    public class CSVField {
027    
028        private String name;
029        private int size;
030        private int fill;
031        private boolean overrideFill;
032    
033        /**
034         *
035         */
036        public CSVField() {
037        }
038    
039        /**
040         * @param name the name of the field
041         */
042        public CSVField(String name) {
043            setName(name);
044        }
045    
046        /**
047         * @param name the name of the field
048         * @param size the size of the field
049         */
050        public CSVField(String name, int size) {
051            setName(name);
052            setSize(size);
053        }
054    
055        /**
056         * @return the name of the field
057         */
058        public String getName() {
059            return name;
060        }
061    
062        /**
063         * Set the name of the field
064         *
065         * @param name the name
066         */
067        public void setName(String name) {
068            this.name = name;
069        }
070    
071        /**
072         * @return the size of the field
073         */
074        public int getSize() {
075            return size;
076        }
077    
078        /**
079         * Set the size of the field.
080         * The size will be ignored when fixedwidth is set to false in the CSVConfig
081         *
082         * @param size the size of the field.
083         */
084        public void setSize(int size) {
085            this.size = size;
086        }
087    
088        /**
089         * @return the fill pattern.
090         */
091        public int getFill() {
092            return fill;
093        }
094    
095        /**
096         * Sets overrideFill to true.
097         *
098         * @param fill the file pattern
099         */
100        public void setFill(int fill) {
101            overrideFill = true;
102            this.fill = fill;
103        }
104    
105        /**
106         * Does this field override fill ?
107         *
108         * @return
109         */
110        public boolean overrideFill() {
111            return overrideFill;
112        }
113    
114    }