Jasper reports Jaspersoft自定义函数未显示在表达式编辑器中
我搜索过谷歌和Stackoverflow,但我就是找不到我问题的答案 我目前使用的是Jaspersoft Studio 5.6.2 final,我试图在我的表达式编辑器中显示一个自定义函数,但无论我尝试什么,我都无法获得要显示的类别和函数 我开始学习上的教程。使用Functions Librry向导(使用File>New>Other>Jaspersoft Studio>Functions Library)生成所有必需的arry文件并创建函数本身很容易 在本教程中,*.properties文件的配置方式不是很清楚,所以我也看了一下,在对属性文件进行了调整之后,自定义函数和类别仍然没有显示出来 我已经尝试直接在Jaspersoft内部测试我的代码,将其导出到jar文件,在另一个Eclipse中创建jar文件,并重新启动Jaspersoft Studio。什么都不管用 下面是我的文件的内容 类别类Jasper reports Jaspersoft自定义函数未显示在表达式编辑器中,jasper-reports,jaspersoft-studio,Jasper Reports,Jaspersoft Studio,我搜索过谷歌和Stackoverflow,但我就是找不到我问题的答案 我目前使用的是Jaspersoft Studio 5.6.2 final,我试图在我的表达式编辑器中显示一个自定义函数,但无论我尝试什么,我都无法获得要显示的类别和函数 我开始学习上的教程。使用Functions Librry向导(使用File>New>Other>Jaspersoft Studio>Functions Library)生成所有必需的arry文件并创建函数本身很容易 在本教程中,*.properties文件的配
package net.sf.jasperreports.functions.custom;
import net.sf.jasperreports.functions.annotations.FunctionCategory;
// I've also tried @FunctionCategory("Able")
@FunctionCategory()
public final class Able {
}
net.sf.jasperreports.extension.registry.factory.functions=net.sf.jasperreports.functions.FunctionsRegistryFactory
net.sf.jasperreports.extension.functions.ablefunctions=eu.able.functions.AbleFunctions
包含函数的类
package net.sf.jasperreports.functions.custom;
import net.sf.jasperreports.functions.annotations.Function;
import net.sf.jasperreports.functions.annotations.FunctionCategories;
import net.sf.jasperreports.functions.annotations.FunctionParameter;
import net.sf.jasperreports.functions.annotations.FunctionParameters;
import net.sf.jasperreports.functions.standard.TextCategory;
@FunctionCategories({ Able.class, TextCategory.class })
public final class AbleFunctions
{
/**
* Returns a barcode the custom font IDAutomationSHI25M will understand based on the page number
* and whether or not the current pagenumber is the lastpage
* @param pagenumber
* @param lastpage
* @return
*/
@Function("CREATE_BARCODE")
@FunctionParameters({
@FunctionParameter("pagenumber"),
@FunctionParameter("lastpage")})
public static String CREATE_BARCODE(Integer pagenumber, boolean lastpage)
{
String[] barcodeArray = {"!","\"", "#", "$", "%", "&", "(", ")", "*", "+", ",", "-", ".","/",
"0", "1", "2", "3", "4", "5", "6", "7", "8","9", ":", ";", "<", "=", ">", "?", "@",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
"R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^","_", "`","a", "b",
"c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "┼", "ã", "Ã", "╚", "╔", "╩"};
String onePage = barcodeArray[1] + barcodeArray[1];
String middlePagePrefix = barcodeArray[0];
String lastPagePrefix = barcodeArray[10];
// There are a couple of specific conditions that will generate a specific outcome.
// Checking these conditions first
if (pagenumber == 1 && lastpage) {
return onePage;
} else if (pagenumber > 1 && lastpage) {
return lastPagePrefix + barcodeArray[pagenumber];
} else {
return middlePagePrefix + barcodeArray[pagenumber];
}
}
}
jasperreports\u extension.properties
package net.sf.jasperreports.functions.custom;
import net.sf.jasperreports.functions.annotations.FunctionCategory;
// I've also tried @FunctionCategory("Able")
@FunctionCategory()
public final class Able {
}
net.sf.jasperreports.extension.registry.factory.functions=net.sf.jasperreports.functions.FunctionsRegistryFactory
net.sf.jasperreports.extension.functions.ablefunctions=eu.able.functions.AbleFunctions
正如您在AbleFunctions类中看到的,我也尝试将该函数添加到现有的TextCategory类中,但这也没有效果
有人知道问题出在哪里吗?这已经花了我几天没有任何成功,所以任何帮助将是伟大的 这似乎是最新版本的社区版修复的一个旧错误: