本文整理匯總了Java中net.sf.jasperreports.engine.JasperReport.getParameters方法的典型用法代碼示例。如果您正苦於以下問題:Java JasperReport.getParameters方法的具體用法?Java JasperReport.getParameters怎麽用?Java JasperReport.getParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.sf.jasperreports.engine.JasperReport
的用法示例。
在下文中一共展示了JasperReport.getParameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReportParams
import net.sf.jasperreports.engine.JasperReport; //導入方法依賴的package包/類
public static String[] getReportParams(JasperReport jasperReport){
JRParameter[] jrp = jasperReport.getParameters();
ArrayList<String> list = new ArrayList<String>();
if(jrp != null){
for (int i = 0 ; i < jrp.length; i++){
if(!jrp[i].isSystemDefined()){
list.add(jrp[i].getName());
MiscUtils.getLogger().debug("JRP "+i+" :"+jrp[i].getName());
}
}
}
String[] s = new String[list.size()];
return list.toArray(s);
}
示例2: formatParameter
import net.sf.jasperreports.engine.JasperReport; //導入方法依賴的package包/類
private Object formatParameter(VariablesSecureApp vars, String strParamName,
String strParamValue, String reference, JasperReport jasperReport) throws ServletException {
String strObjectClass = "";
Object object;
JRParameter[] jrparams = jasperReport.getParameters();
for (int i = 0; i < jrparams.length; i++) {
if (jrparams[i].getName().equals(strParamName))
strObjectClass = jrparams[i].getValueClassName();
}
if (log4j.isDebugEnabled())
log4j.debug("ClassType: " + strObjectClass);
if (strObjectClass.equals("java.lang.String")) {
object = new String(strParamValue);
} else if (strObjectClass.equals("java.util.Date")) {
String strDateFormat;
strDateFormat = vars.getJavaDateFormat();
SimpleDateFormat dateFormat = new SimpleDateFormat(strDateFormat);
try {
object = dateFormat.parse(strParamValue);
} catch (Exception e) {
throw new ServletException(e.getMessage());
}
} else {
object = new String(strParamValue);
}
return object;
}