提交 6a65ea81 编写于 作者: K kohsuke

added custom size() function.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2697 71c3de6d-444a-0410-be80-ed276b4c234a
上级 3abdae41
......@@ -12,6 +12,7 @@ import hudson.model.Action;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.apache.commons.jexl.parser.ASTSizeFunction;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
......@@ -366,4 +367,13 @@ public class Functions {
else
return "images/24x24/"+name;
}
/**
* Works like JSTL build-in size(x) function,
* but handle null gracefully.
*/
public static int size(Object o) throws Exception {
if(o==null) return 0;
return ASTSizeFunction.sizeOf(o);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册