~ubuntu-branches/ubuntu/quantal/commons-csv/quantal

« back to all changes in this revision

Viewing changes to src/java/org/apache/commons/csv/writer/CSVField.java

  • Committer: Bazaar Package Importer
  • Author(s): Jan-Pascal van Best
  • Date: 2007-07-27 09:45:30 UTC
  • Revision ID: james.westby@ubuntu.com-20070727094530-iy6ls22i7yj3p0sg
Tags: upstream-0.1-SNAPSHOT+svn558885
ImportĀ upstreamĀ versionĀ 0.1-SNAPSHOT+svn558885

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}