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.JRExpression; 34 import net.sf.jasperreports.engine.JRParameter; 35 import net.sf.jasperreports.engine.JRRuntimeException; 36 import net.sf.jasperreports.engine.util.JRClassLoader; 37 38 39 43 public class JRBaseParameter implements JRParameter, Serializable 44 { 45 46 47 50 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 51 52 55 protected String name = null; 56 protected String description = null; 57 protected String valueClassName = java.lang.String .class.getName(); 58 protected boolean isSystemDefined = false; 59 protected boolean isForPrompting = true; 60 61 protected transient Class valueClass = null; 62 63 66 protected JRExpression defaultValueExpression = null; 67 68 69 72 protected JRBaseParameter() 73 { 74 } 75 76 77 80 protected JRBaseParameter(JRParameter parameter, JRBaseObjectFactory factory) 81 { 82 factory.put(parameter, this); 83 84 name = parameter.getName(); 85 description = parameter.getDescription(); 86 valueClassName = parameter.getValueClassName(); 87 isSystemDefined = parameter.isSystemDefined(); 88 isForPrompting = parameter.isForPrompting(); 89 90 defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression()); 91 } 92 93 94 97 public String getName() 98 { 99 return this.name; 100 } 101 102 105 public String getDescription() 106 { 107 return this.description; 108 } 109 110 113 public void setDescription(String description) 114 { 115 this.description = description; 116 } 117 118 121 public Class getValueClass() 122 { 123 if (valueClass == null) 124 { 125 if (valueClassName != null) 126 { 127 try 128 { 129 valueClass = JRClassLoader.loadClassForName(valueClassName); 130 } 131 catch(ClassNotFoundException e) 132 { 133 throw new JRRuntimeException(e); 134 } 135 } 136 } 137 138 return valueClass; 139 } 140 141 144 public String getValueClassName() 145 { 146 return valueClassName; 147 } 148 149 152 public boolean isSystemDefined() 153 { 154 return this.isSystemDefined; 155 } 156 157 160 public boolean isForPrompting() 161 { 162 return this.isForPrompting; 163 } 164 165 168 public JRExpression getDefaultValueExpression() 169 { 170 return this.defaultValueExpression; 171 } 172 173 174 } 175 | Popular Tags |