protected T init() { return Unchecked.call(supplier); }
public static void run(UncheckedRunnable runnable) { run(runnable, null); }
public T getRaw(Map<String, Object> model) { if (!prepared) { synchronized (this) { if (!prepared) { Unchecked.run(() -> { if (stringTemplate) expression = EvalTools.prepare(string, model, TagLib.getTagFunctions(), imports, true); else { Matcher m = p.matcher(string); if (m.matches()) { String exp = m.group(1); if (exp == null) { exp = m.group(2); } if (exp == null) { exp = m.group(3); } expression = EvalTools.prepare(exp, model, TagLib.getTagFunctions(), imports); } else expression = EvalTools.prepare(string, model, TagLib.getTagFunctions(), imports); } setVariables(expression); }); prepared = true; } } } return Unchecked.call(() -> (T) expression.get(model)); }
public static <T> T ignore(Callable<T> callable) { return ignore(callable, null); }
protected void loadManifest(Config config) { Unchecked.ignore(() -> { Manifest manifest = new Manifest(WebApplication.class.getResourceAsStream("/META-INF/MANIFEST.MF")); Config subconfig = config.config("manifest"); manifest.getMainAttributes().forEach((k, v) -> putInto(subconfig, String.valueOf(k), String.valueOf(v))); }); }
protected String getCanonicalPath(File file) { return Unchecked.call(file::getCanonicalPath); }
@Override public void onComplete() { Unchecked.run(() -> ProxyConnection.this.onRead((ByteBufferProvider) Thread.currentThread())); } }
public String getResourceAsString(String path) { return Unchecked.ignore(() -> new String(IOTools.bytes(getResource(path)), StandardCharsets.UTF_8)); }
public static <T> T call(Callable<T> callable) { return call(callable, null); }
public PropertiesMessageSource(String name, ResourceTools resourcesTools) { Properties properties = new Properties(); Unchecked.run(() -> properties.load(resourcesTools.getResource("/i18n/" + name + ".properties"))); for (Map.Entry<Object, Object> entry : properties.entrySet()) { templates.put(String.valueOf(entry.getKey()), new Template(String.valueOf(entry.getValue()))); } } }
protected T init() { return Unchecked.call(supplier); }
protected void checkResponse(int status, String message, com.wizzardo.tools.http.Response response) { Unchecked.run(() -> { Assert.assertEquals(status, response.getResponseCode()); Assert.assertEquals(message, response.asString()); }); }
public static Tag createTag(String name) { Class<? extends Tag> c = taglib.get(name); if (c == null) return null; return Unchecked.call(c::newInstance); }
response.commit(request.connection()); request.connection().flush(); Unchecked.run(() -> request.connection().onFinishingHandling()); }); return response;