Coverage Report - org.kuali.rice.core.jpa.metadata.FieldDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldDescriptor
0%
0/82
0%
0/10
1.212
 
 1  
 /*
 2  
  * Copyright 2007-2008 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.jpa.metadata;
 17  
 
 18  
 import java.io.Serializable;
 19  
 
 20  
 import javax.persistence.TemporalType;
 21  
 
 22  
 /**
 23  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 24  
  */
 25  0
 public class FieldDescriptor implements Comparable, Serializable {
 26  
 
 27  
         private static final long serialVersionUID = -4231007918447422886L;
 28  
         
 29  
         private String name;
 30  
         private Class clazz;
 31  
         private String column;
 32  0
         private int length = 255;
 33  0
         private int scale = 0;
 34  0
         private int precision = 0;
 35  0
         private boolean id = false;
 36  0
         private boolean lob = false;
 37  0
         private boolean temporal = false;
 38  0
         private boolean version = false;
 39  0
         private boolean unique = false;
 40  0
         private boolean nullable = true;
 41  0
         private boolean insertable = true;
 42  0
         private boolean updateable = true;
 43  
         private TemporalType temporalType;
 44  
 
 45  
         public String getName() {
 46  0
                 return name;
 47  
         }
 48  
 
 49  
         public void setName(String name) {
 50  0
                 this.name = name;
 51  0
         }
 52  
         
 53  
         public Class getClazz() {
 54  0
                 return clazz;
 55  
         }
 56  
         
 57  
         public void setClazz(Class clazz) {
 58  0
                 this.clazz = clazz;
 59  0
         }
 60  
         
 61  
         public String getColumn() {
 62  0
                 return column;
 63  
         }
 64  
         
 65  
         public void setColumn(String column) {
 66  0
                 this.column = column;
 67  0
         }
 68  
         
 69  
         public int getLength() {
 70  0
                 return length;
 71  
         }
 72  
         
 73  
         public void setLength(int length) {
 74  0
                 this.length = length;
 75  0
         }
 76  
         
 77  
         public int getScale() {
 78  0
                 return scale;
 79  
         }
 80  
         
 81  
         public void setScale(int scale) {
 82  0
                 this.scale = scale;
 83  0
         }
 84  
         
 85  
         public int getPrecision() {
 86  0
                 return precision;
 87  
         }
 88  
         
 89  
         public void setPrecision(int precision) {
 90  0
                 this.precision = precision;
 91  0
         }
 92  
         
 93  
         public boolean isId() {
 94  0
                 return id;
 95  
         }
 96  
         
 97  
         public void setId(boolean id) {
 98  0
                 this.id = id;
 99  0
         }
 100  
         
 101  
         public boolean isLob() {
 102  0
                 return lob;
 103  
         }
 104  
         
 105  
         public void setLob(boolean lob) {
 106  0
                 this.lob = lob;
 107  0
         }
 108  
         
 109  
         public boolean isTemporal() {
 110  0
                 return temporal;
 111  
         }
 112  
         
 113  
         public void setTemporal(boolean temporal) {
 114  0
                 this.temporal = temporal;
 115  0
         }
 116  
         
 117  
         public boolean isVersion() {
 118  0
                 return version;
 119  
         }
 120  
         
 121  
         public void setVersion(boolean version) {
 122  0
                 this.version = version;
 123  0
         }
 124  
         
 125  
         public boolean isUnique() {
 126  0
                 return unique;
 127  
         }
 128  
         
 129  
         public void setUnique(boolean unique) {
 130  0
                 this.unique = unique;
 131  0
         }
 132  
         
 133  
         public boolean isNullable() {
 134  0
                 return nullable;
 135  
         }
 136  
         
 137  
         public void setNullable(boolean nullable) {
 138  0
                 this.nullable = nullable;
 139  0
         }
 140  
         
 141  
         public boolean isInsertable() {
 142  0
                 return insertable;
 143  
         }
 144  
         
 145  
         public void setInsertable(boolean insertable) {
 146  0
                 this.insertable = insertable;
 147  0
         }
 148  
         
 149  
         public boolean isUpdateable() {
 150  0
                 return updateable;
 151  
         }
 152  
         
 153  
         public void setUpdateable(boolean updateable) {
 154  0
                 this.updateable = updateable;
 155  0
         }
 156  
         
 157  
         public TemporalType getTemporalType() {
 158  0
                 return temporalType;
 159  
         }
 160  
         
 161  
         public void setTemporalType(TemporalType temporalType) {
 162  0
                 this.temporalType = temporalType;
 163  0
         }
 164  
         
 165  
         public static long getSerialVersionUID() {
 166  0
                 return serialVersionUID;
 167  
         }        
 168  
         
 169  
         public String toString() {
 170  0
                 StringBuffer sb = new StringBuffer();
 171  0
                 sb.append("FieldDescriptor = [ ");
 172  0
                 sb.append("name:").append(name).append(", ");
 173  0
                 sb.append("column:").append(column).append(", ");
 174  0
                 sb.append("class:").append(clazz).append(", ");
 175  0
                 sb.append("length:").append(length).append(", ");
 176  0
                 sb.append("scale:").append(scale).append(", ");
 177  0
                 sb.append("precision:").append(precision).append(", ");
 178  0
                 sb.append("unique:").append(unique).append(", ");
 179  0
                 sb.append("nullable:").append(nullable).append(", ");
 180  0
                 sb.append("insertable:").append(insertable).append(", ");
 181  0
                 sb.append("updateable:").append(updateable).append(", ");
 182  0
                 sb.append("lob:").append(lob).append(", ");
 183  0
                 sb.append("version:").append(version).append(", ");
 184  0
                 sb.append("temporal:").append(temporal);
 185  0
                 if (temporal) {
 186  0
                         sb.append(", temporalType:").append(temporalType);
 187  
                 }
 188  0
                 sb.append(" ]");
 189  0
                 return sb.toString();
 190  
         }
 191  
 
 192  
         /**
 193  
          * This overridden method ...
 194  
          * 
 195  
          * @see java.lang.Comparable#compareTo(java.lang.Object)
 196  
          */
 197  
         public int compareTo(Object that) {
 198  0
                 if (that == null || !(that instanceof FieldDescriptor)) {
 199  0
                         return -1;
 200  
                 }                
 201  0
                 if (this.getName() == null || ((FieldDescriptor)that).getName() == null) {
 202  0
                         return 0;
 203  
                 }
 204  0
                 return this.getName().compareTo(((FieldDescriptor)that).getName());
 205  
         }
 206  
 
 207  
 }