1 /*
2 Copyright 2006 Paul Zepernick
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software distributed
11 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 CONDITIONS OF ANY KIND, either express or implied. See the License for
13 the specific language governing permissions and limitations under the License.
14 */
15 package net.sf.flatpack.structure;
16
17 /**
18 * @author Paul zepernick
19 *
20 * Holds information about the columns in the data set. This is an improvment
21 * over 1.0.x. This information was being repeated for every row, causing a
22 * spike in memory usage
23 *
24 * @version 2.0
25 */
26 public class ColumnMetaData {
27
28 /** Column Name */
29 private String colName = null;
30
31 /** column length */
32 private int colLength = 0;
33
34 /** starting position */
35 private int startPosition = 0;
36
37 /** ending position */
38 private int endPosition = 0;
39
40 public ColumnMetaData() {
41 super();
42 }
43
44 /**
45 * @param colName column name
46 */
47 public ColumnMetaData(final String colName) {
48 super();
49 this.colName = colName;
50 }
51
52 /**
53 * Returns the colLength.
54 *
55 * @return int
56 */
57 public int getColLength() {
58 return colLength;
59 }
60
61 /**
62 * Returns the colName.
63 *
64 * @return String
65 */
66 public String getColName() {
67 return colName;
68 }
69
70 /**
71 * Returns the endPosition.
72 *
73 * @return int
74 */
75 public int getEndPosition() {
76 return endPosition;
77 }
78
79 /**
80 * Returns the startPosition.
81 *
82 * @return int
83 */
84 public int getStartPosition() {
85 return startPosition;
86 }
87
88 /**
89 * Sets the colLength.
90 *
91 * @param colLength
92 * The colLength to set
93 */
94 public void setColLength(final int colLength) {
95 this.colLength = colLength;
96 }
97
98 /**
99 * Sets the colName.
100 *
101 * @param colName
102 * The colName to set
103 */
104 public void setColName(final String colName) {
105 this.colName = colName;
106 }
107
108 /**
109 * Sets the endPosition.
110 *
111 * @param endPosition
112 * The endPosition to set
113 */
114 public void setEndPosition(final int endPosition) {
115 this.endPosition = endPosition;
116 }
117
118 /**
119 * Sets the startPosition.
120 *
121 * @param startPosition
122 * The startPosition to set
123 */
124 public void setStartPosition(final int startPosition) {
125 this.startPosition = startPosition;
126 }
127
128 @Override
129 public String toString() {
130 final StringBuilder buf = new StringBuilder();
131 buf.append("Name:").append(colName).append(" Length:").append(colLength).append(" Start:").append(startPosition);
132 buf.append(" End:").append(endPosition).append(System.getProperty("line.separator"));
133 return buf.toString();
134 }
135 }