提交 b93be7d5 编写于 作者: K kohsuke

added a convenience method.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5503 71c3de6d-444a-0410-be80-ed276b4c234a
上级 db8f71c0
......@@ -627,6 +627,17 @@ public class Functions {
return b;
}
/**
* If the value exists, return that value. Otherwise return the default value.
* <p>
* This method is useful for supplying a default value to a form field.
*
* @since 1.150
*/
public static Object defaulted(Object value, Object defaultValue) {
return value!=null ? value : defaultValue;
}
public static String printThrowable(Throwable t) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册