/** * Returns the first non-null, non-empty string in the list. * * @param s The strings to test. * @return The first non-empty string in the list, or <jk>null</jk> if they were all <jk>null</jk> or empty. */ public static String firstNonEmpty(String...s) { for (String ss : s) if (isNotEmpty(ss)) return ss; return null; }
/** * Returns <jk>true</jk> if the version property is not null or empty. * * @return <jk>true</jk> if the version property is not null or empty. */ public boolean hasVersion() { return isNotEmpty(version); }
/** * Returns <jk>true</jk> if the name property is not null or empty. * * @return <jk>true</jk> if the name property is not null or empty. */ public boolean hasName() { return isNotEmpty(name); }
/** * Returns <jk>true</jk> if the description property is not null or empty. * * @return <jk>true</jk> if the description property is not null or empty. */ public boolean hasDescription() { return isNotEmpty(description); }
/** * Returns <jk>true</jk> if the name property is not null or empty. * * @return <jk>true</jk> if the name property is not null or empty. */ public boolean hasName() { return isNotEmpty(name); }
/** * Returns <jk>true</jk> if the summary property is not null or empty. * * @return <jk>true</jk> if the summary property is not null or empty. */ public boolean hasSummary() { return isNotEmpty(summary); }
/** * Returns <jk>true</jk> if the title property is not null or empty. * * @return <jk>true</jk> if the title property is not null or empty. */ public boolean hasTitle() { return isNotEmpty(title); }
/** * Returns <jk>true</jk> if the summary property is not null or empty. * * @return <jk>true</jk> if the summary property is not null or empty. */ public boolean hasSummary() { return isNotEmpty(summary); }
/** * Returns <jk>true</jk> if the description property is not null or empty. * * @return <jk>true</jk> if the description property is not null or empty. */ public boolean hasDescription() { return isNotEmpty(description); }
/** * Returns <jk>true</jk> if the description property is not null or empty. * * @return <jk>true</jk> if the description property is not null or empty. */ public boolean hasDescription() { return isNotEmpty(description); }
/** * Returns <jk>true</jk> if the termsOfService property is not null or empty. * * @return <jk>true</jk> if the termsOfService property is not null or empty. */ public boolean hasTermsOfService() { return isNotEmpty(termsOfService); }
/** * Returns <jk>true</jk> if the email property is not null or empty. * * @return <jk>true</jk> if the email property is not null or empty. */ public boolean hasEmail() { return isNotEmpty(email); }
/** * Returns <jk>true</jk> if the title property is not null or empty. * * @return <jk>true</jk> if the title property is not null or empty. */ public boolean hasTitle() { return isNotEmpty(title); }
/** * Returns <jk>true</jk> if the name property is not null or empty. * * @return <jk>true</jk> if the name property is not null or empty. */ public boolean hasName() { return isNotEmpty(name); }
/** * Returns <jk>true</jk> if the description property is not null or empty. * * @return <jk>true</jk> if the description property is not null or empty. */ public boolean hasDescription() { return isNotEmpty(description); }
/** * Returns <jk>true</jk> if the name property is not null or empty. * * @return <jk>true</jk> if the name property is not null or empty. */ public boolean hasName() { return isNotEmpty(name); }
/** * Returns <jk>true</jk> if the description property is not null or empty. * * @return <jk>true</jk> if the description property is not null or empty. */ public boolean hasDescription() { return isNotEmpty(description); }
final static Number toNumber(String s) { try { if (isNotEmpty(s)) return parseNumber(s, Number.class); return null; } catch (ParseException e) { throw new RuntimeException(e); } }
/** * Returns <jk>true</jk> if this section contains the specified key and the key has a non-blank value. * * @param key The key. * @return <jk>true</jk> if this section contains the specified key and the key has a non-blank value. */ public boolean exists(String key) { return isNotEmpty(getString(key, null)); }
@Override /* HttpServletRequest */ public String getPathInfo() { if (pathInfo == null) { pathInfo = getRequestURI(); if (isNotEmpty(contextPath)) pathInfo = pathInfo.substring(contextPath.length()); if (isNotEmpty(servletPath)) pathInfo = pathInfo.substring(servletPath.length()); } return nullIfEmpty(urlDecode(pathInfo)); }