1 28 package net.sf.jasperreports.engine.base; 29 30 import java.io.Serializable ; 31 32 import net.sf.jasperreports.engine.JRConstants; 33 import net.sf.jasperreports.engine.JRField; 34 import net.sf.jasperreports.engine.JRRuntimeException; 35 import net.sf.jasperreports.engine.util.JRClassLoader; 36 37 38 42 public class JRBaseField implements JRField, Serializable 43 { 44 45 46 49 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 50 51 54 protected String name = null; 55 protected String description = null; 56 protected String valueClassName = java.lang.String .class.getName(); 57 58 protected transient Class valueClass = null; 59 60 61 64 protected JRBaseField() 65 { 66 } 67 68 69 72 protected JRBaseField(JRField field, JRBaseObjectFactory factory) 73 { 74 factory.put(field, this); 75 76 name = field.getName(); 77 description = field.getDescription(); 78 valueClassName = field.getValueClassName(); 79 } 80 81 82 85 public String getName() 86 { 87 return this.name; 88 } 89 90 93 public String getDescription() 94 { 95 return this.description; 96 } 97 98 101 public void setDescription(String description) 102 { 103 this.description = description; 104 } 105 106 109 public Class getValueClass() 110 { 111 if (valueClass == null) 112 { 113 if (valueClassName != null) 114 { 115 try 116 { 117 valueClass = JRClassLoader.loadClassForName(valueClassName); 118 } 119 catch(ClassNotFoundException e) 120 { 121 throw new JRRuntimeException(e); 122 } 123 } 124 } 125 126 return valueClass; 127 } 128 129 132 public String getValueClassName() 133 { 134 return this.valueClassName; 135 } 136 137 138 } 139 | Popular Tags |