如何解决如何使用ElManager.importStatic?在互联网上找不到任何示例
我正在尝试以独立方式执行一些Java EL:
ELProcessor elp = new ELProcessor();
elp.defineBean("value",result);
elp.getELManager().importStatic("org.apache.commons.lang3.StringUtils.isAlpha");
Object eval = elp.eval("isAlpha(value)");
我不知道如何导入isAlpha静态函数。该文档似乎并没有太大帮助:
https://docs.oracle.com/javaee/7/api/javax/el/ELManager.html
/**
* Import a static field or method. The class of the static member must be
* loadable from the classloader,at class resolution time.
* @param staticMemberName The full class name of the class to be imported
* @throws ELException if the name is not a full class name.
*/
public void importStatic(String staticMemberName) throws ELException {
getELContext().getImportHandler().importStatic(staticMemberName);
}
有人有使用importStatic
的示例吗?我似乎在互联网上找不到任何东西。谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。