/** * Returns the provided value or null if the value is empty. * * @see #isEmpty(java.lang.Object) */ public static <T> T nullIfEmpty(T value) throws IOException { return isEmpty(value) ? null : value; }
/** * Returns the provided number or zero if the value is empty. * * @see #isEmpty(java.lang.Object) */ public static int zeroIfEmpty(Integer value) throws IOException { return isEmpty(value) ? 0 : value; }
public static ReadableDateTime toDateTime(Object o) throws IOException { if(o instanceof ReadableDateTime) { return (ReadableDateTime)o; } if(o instanceof Long) { long l = (Long)o; return l==-1 || l==0 ? null : new DateTime(l); } if(Coercion.isEmpty(o)) { return null; } return new DateTime(o); }
public static interface LinkImplBody<E extends Throwable> { void doBody(boolean discard) throws E, IOException, SkipPageException; }