View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.commons.csv.writer;
20  
21  
22  /**
23   * 
24   * @author Martin van den Bemt
25   * @version $Id: $
26   */
27  public class CSVField {
28  
29      private String name;
30      private int size;
31      private int fill;
32      private boolean overrideFill;
33  
34      /**
35       * 
36       */
37      public CSVField() {
38      }
39  
40      /**
41       * @param name the name of the field
42       */
43      public CSVField(String name) {
44          setName(name);
45      }
46  
47      /**
48       * @param name the name of the field
49       * @param size the size of the field
50       */
51      public CSVField(String name, int size) {
52          setName(name);
53          setSize(size);
54      }
55  
56      /**
57       * @return the name of the field
58       */
59      public String getName() {
60          return name;
61      }
62      
63      /**
64       * Set the name of the field
65       * @param name the name
66       */
67      public void setName(String name) {
68          this.name = name;
69      }
70  
71      /**
72       * 
73       * @return the size of the field
74       */
75      public int getSize() {
76          return size;
77      }
78  
79      /**
80       * Set the size of the field.
81       * The size will be ignored when fixedwidth is set to false in the CSVConfig
82       * @param size the size of the field.
83       */
84      public void setSize(int size) {
85          this.size = size;
86      }
87  
88      /**
89       * @return the fill pattern.
90       */
91      public int getFill() {
92          return fill;
93      }
94  
95      /**
96       * Sets overrideFill to true.
97       * @param fill the file pattern
98       */
99      public void setFill(int fill) {
100         overrideFill = true;
101         this.fill = fill;
102     }
103     
104     /**
105      * Does this field override fill ?
106      * 
107      * @return
108      */
109     public boolean overrideFill() {
110         return overrideFill;
111     }
112 
113 }