|
|
@@ -0,0 +1,29 @@
|
|
|
+/*
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ * @copyright Ranides Atterwim
|
|
|
+ * @license WTFPL
|
|
|
+ * @url http://ranides.net/projects/assira
|
|
|
+ */
|
|
|
+package net.ranides.assira.generic;
|
|
|
+
|
|
|
+import net.ranides.assira.text.LexicalCast;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author ranides
|
|
|
+ */
|
|
|
+public abstract class AnyFunction implements Function<Object, Object[]> {
|
|
|
+
|
|
|
+ public final Object call(Object... args) {
|
|
|
+ return apply(args);
|
|
|
+ }
|
|
|
+
|
|
|
+ public final <T> T safecall(Class<T> target, Object... args) {
|
|
|
+ return LexicalCast.cast(apply(args), target);
|
|
|
+ }
|
|
|
+
|
|
|
+ public final <T> T safecall(TypeToken<T> target, Object... args) {
|
|
|
+ return LexicalCast.cast(apply(args), target);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|