Project Report: fawkez

Packagesummary org.jcoderz.phoenix.sqlparser

org.jcoderz.phoenix.sqlparser.ColumnSpec

LineHitsNoteSource
1  /*
2   * $Id: ColumnSpec.java 1011 2008-06-16 17:57:36Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.phoenix.sqlparser;
34  
35  import java.util.ArrayList;
36  import java.util.Iterator;
37  import java.util.List;
38  
39  /**
40   * @author Albrecht Messner
41   */
42100 public class ColumnSpec
43  {
44     private String mColumnName;
45     private String mColumnType;
46     
47     private String mJavaType;
48     private String mStoreMethod;
49     private String mLoadMethod;
50     private String mCurrencyColumn;
51     private String mPeriodFieldName;
52     private String mPeriodEndDateColumn;
53     private String mWeblogicColumnType;
54100    private boolean mPeriodDefined = false;
55100    private boolean mSkipInInterface = false;
56     
57100    private final List mDatatypeAttributes = new ArrayList();
58100    private final List mAttributes = new ArrayList();
59     
60100    private boolean mIsNotNull = false;
61100    private boolean mIsPrimaryKey = false;
62100    private boolean mIsUnique = false;
63     
64     private String mAnnotation;
65  
66     /**
67      * Returns the name of this column.
68      * @return the name of this column
69      */
70     public final String getColumnName ()
71     {
72100       return mColumnName;
73     }
74  
75     /**
76      * Sets the name of this column.
77      * @param string the name of this column
78      */
79     public final void setColumnName (String string)
80     {
81100       mColumnName = string;
82100    }
83  
84     /**
85      * Returns the data type for this column.
86      * @return the data type for this column
87      */
88     public final String getColumnType ()
89     {
90100       return mColumnType;
91     }
92  
93  
94     /**
95      * Sets the data type for this column.
96      * @param string the data type
97      */
98     public final void setColumnType (String string)
99     {
100100       mColumnType = string;
101100    }
102  
103     
104     /**
105      * Returns a list of all attributes of this colspec.
106      * The elements of this list are of type ColumnAttribute.
107      * @return a list of all attributes of this colspec
108      */
109     public final List getAttributes ()
110     {
1110       return mAttributes;
112     }
113  
114     /**
115      * Adds an attribute to this column spec.
116      * @param attr the attribute to add
117      */
118     public final void addAttribute (ColumnAttribute attr)
119     {
120100       mAttributes.add(attr);
121100    }
122  
123     /**
124      * Adds an attribute to the datatype of this colspec.
125      * @param attr the datatype attribute that should be added
126      */
127     public final void addDatatypeAttribute (ColumnAttribute attr)
128     {
129100       mDatatypeAttributes.add(attr);
130100    }
131  
132     /**
133      * Returns the datatype attributes of this colspec.
134      * @return a list of datatype attributes
135      */
136     public final List getDatatypeAttributes ()
137     {
138100       return mDatatypeAttributes;
139     }
140  
141     /**
142      * Returns the java type to which this column maps.
143      * @return the java type to which this column maps
144      */
145     public final String getJavaType ()
146     {
1470       return mJavaType;
148     }
149  
150     /**
151      * Sets the java type for this column.
152      * @param type the java type for this column
153      */
154     public final void setJavaType (String type)
155     {
156100       mJavaType = type;
157100    }
158  
159     /**
160      * Returns the method used when loading the custom type from the db.
161      * @return the method used when loading the custom type from the db
162      */
163     public final String getLoadMethod ()
164     {
1650       return mLoadMethod;
166     }
167  
168     /**
169      * Sets the method used when loading the custom type from the db.
170      * @param methodName the method used when loading the custom type from the db
171      */
172     public final void setLoadMethod (String methodName)
173     {
174100       mLoadMethod = methodName;
175100    }
176  
177     /**
178      * Returns the method used when storing the type to the db.
179      * @return the method used when storing the type to the db
180      */
181     public final String getStoreMethod ()
182     {
1830       return mStoreMethod;
184     }
185  
186     /**
187      * Sets the method used when storing the type to the db.
188      * @param methodName the method used when storing the type to the db
189      */
190     public final void setStoreMethod (String methodName)
191     {
192100       mStoreMethod = methodName;
193100    }
194  
195     /**
196      * Returns whether this column is not null.
197      * @return true if this column is not null, false otherwise
198      */
199     public final boolean isNotNull ()
200     {
201100       return mIsNotNull;
202     }
203     
204     /**
205      * Set whether this column is not null.
206      * @param b flag indicating whether this column is not null
207      */
208     public final void setNotNull (boolean b)
209     {
210100       mIsNotNull = b;
211100    }
212  
213     /**
214      * Returns whether this column is primary key.
215      * @return true if this column is primary key, false otherwise
216      */
217     public final boolean isPrimaryKey ()
218     {
219100       return mIsPrimaryKey;
220     }
221  
222     /**
223      * Set whether this column is primary key or not.
224      * @param b flag indicating whether this column is primary key
225      */
226     public final void setPrimaryKey (boolean b)
227     {
228100       mIsPrimaryKey = b;
229100    }
230  
231     /**
232      * @return Returns the isUnique.
233      */
234     public boolean isUnique ()
235     {
236100       return mIsUnique;
237     }
238     /**
239      * @param isUnique The isUnique to set.
240      */
241     public void setUnique (boolean isUnique)
242     {
243100       mIsUnique = isUnique;
244100    }
245     
246     /** {@inheritDoc} */
247     public final String toString ()
248     {
249100(1)      final StringBuffer sbuf = new StringBuffer();
250100       sbuf.append("[ColumnSpec name=").append(mColumnName);
251100       sbuf.append(", sqlType=").append(mColumnType);
252100       sbuf.append(", javaType=").append(mJavaType);
253100       sbuf.append(", storeMethod=").append(mStoreMethod);
254100       sbuf.append(", loadMethod=").append(mLoadMethod);
255100       if (mIsNotNull)
256        {
257100          sbuf.append(", not null");
258        }
259100       if (mIsPrimaryKey)
260        {
261100          sbuf.append(", primary key");
262        }
263100       if (mIsUnique)
264        {
265100          sbuf.append(", unique");
266        }
267100       for (final Iterator it = mDatatypeAttributes.iterator(); it.hasNext(); )
268        {
269100          final ColumnAttribute attr = (ColumnAttribute) it.next();
270100          sbuf.append(",\n Data Type Attribute: ").append(attr);
271100       }
272100       for (final Iterator it = mAttributes.iterator(); it.hasNext(); )
273        {
274100          final ColumnAttribute attr = (ColumnAttribute) it.next();
275100          sbuf.append(",\n Column Attribute: ").append(attr);
276100       }
277100       return sbuf.toString();
278     }
279  
280 (2)   public void setAnnotation (String annotation)
281     {
2820       mAnnotation = annotation;
2830    }
284     
285 (3)   public String getAnnotation ()
286     {
287100       return mAnnotation;
288     }
289  
290     /**
291      * @return Returns the currencyColumn.
292      */
293     public String getCurrencyColumn ()
294     {
2950       return mCurrencyColumn;
296     }
297  
298     /**
299      * @param currencyColumn The currencyColumn to set.
300      */
301     public void setCurrencyColumn (String currencyColumn)
302     {
303100       mCurrencyColumn = currencyColumn;
304100    }
305     
306 (4)   public boolean isPeriodDefined ()
307     {
3080       return mPeriodDefined;
309     }
310  
311 (5)   public void setIsPeriodDefined (boolean periodDefined)
312     {
313100       mPeriodDefined = periodDefined;
314100    }
315  
316 (6)   public String getPeriodFieldName ()
317     {
3180       return mPeriodFieldName;
319     }
320  
321 (7)   public void setPeriodFieldName (String periodFieldName)
322     {
323100       mPeriodFieldName = periodFieldName;
324100    }
325     
326 (8)   public String getPeriodEndDateColumn ()
327     {
3280       return mPeriodEndDateColumn;
329     }
330  
331 (9)   public void setPeriodEndDateColumn (String endDateColumn)
332     {
333100       mPeriodEndDateColumn = endDateColumn;
334100    }
335     
336 (10)   public boolean isSkipInInterface ()
337     {
3380       return mSkipInInterface;
339     }
340     
341 (11)   public void setSkipInInterface (boolean b)
342     {
343100       mSkipInInterface = b;
344100    }
345  
346 (12)   public String getWeblogicColumnType ()
347     {
3480       return mWeblogicColumnType;
349     }
350     
351 (13)   public void setWeblogicColumnType (String weblogicColumnType)
352     {
353100       mWeblogicColumnType = weblogicColumnType;
354100    }
355  
356 (14)   public boolean isWeblogicColumnTypeDefined ()
357     {
3580       return mWeblogicColumnType != null;
359     }
360  }

Findings in this File

i (1) 249 : 26 StringBuffer constructor is initialized with size 16, but has at least 153 characters appended.
c (2) 280 : 4 Missing a Javadoc comment.
c (3) 285 : 4 Missing a Javadoc comment.
c (4) 306 : 4 Missing a Javadoc comment.
c (5) 311 : 4 Missing a Javadoc comment.
c (6) 316 : 4 Missing a Javadoc comment.
c (7) 321 : 4 Missing a Javadoc comment.
c (8) 326 : 4 Missing a Javadoc comment.
c (9) 331 : 4 Missing a Javadoc comment.
c (10) 336 : 4 Missing a Javadoc comment.
c (11) 341 : 4 Missing a Javadoc comment.
c (12) 346 : 4 Missing a Javadoc comment.
c (13) 351 : 4 Missing a Javadoc comment.
c (14) 356 : 4 Missing a Javadoc comment.