public float floatValue(){ if(floatValueCached) floatValue = StringUtil.toFloat(value); return floatValue; }
public static void throwRuntime(Throwable throwable) { throw toRuntime(throwable); }
public static String join(Iterable<String> iterable, String seperator){ return join(iterable, STRING_JOINER, seperator); }
@Override public boolean isKeepAlive() { if (keepAlive.isMaybe()) { keepAlive = AlmostBoolean.fromBoolean(HttpUtil.isKeepAlive(request)); } return keepAlive.decide(true); }
public void setValue(T value) { call(listener -> listener.valueChange(Referece.this.value, value)); this.value = value; }
public static File findFirstThatExist(String... paths) { for (String path : paths) { if (!StringUtil.isEmpty(path)) { File file = new File(path); if (file.exists()) return file; } } return null; }
public static boolean containsIgnoreCase(String where, String what) { return indexOfIgnoreCase(where, what, 0) >= 0; }
public boolean hasReached(long reached){ return getDelay() > reached; }
public static boolean instanceOfCause(Throwable throwable, Class<? extends Throwable> clazz) { return getInstanceOfCause(throwable, clazz) != null; }
public static boolean isWhiteSpace(char ch){ return !isNoWhiteSpace(ch); }
public static void sleep(long delay) { sleep(delay, true); }
public static boolean isOsVersionAtLeast(String version) { return VersionComparingUtil.compare(OS_VERSION, version) >= 0; }
public static void sleep(long delay, boolean ignore) { try { Thread.sleep(delay); } catch (InterruptedException e) { if (!ignore) { ExceptionUtil.throwRuntime(e); } } }
public static void runWithTimeout(final Runnable runnable, long timeout) throws Exception { runWithTimeout(() -> { runnable.run(); return null; }, timeout); }
public Response setHeader(ResponseHeaders httpHeader, String value) { headers.put(EnumUtil.toDisplayName(httpHeader), value); return this; }
public static boolean endsWithIgnoreCase(String text, String suffix) { int l1 = text.length(); int l2 = suffix.length(); if (l1 < l2) return false; for (int i = l1 - 1; i >= l1 - l2; i--) { if (!charsEqualIgnoreCase(text.charAt(i), suffix.charAt(i + l2 - l1))) { return false; } } return true; }
public static String join(String[] array, String seperator){ return join(array, STRING_JOINER, seperator); }
@Override public void error(String message, Throwable t, String... details) { String fullMessage = details.length > 0 ? message + "\nDetails: " + StringUtil.join(details, "\n") : message; logger4J.error(fullMessage, t); }