diff --git a/meta/src/main/java/io/art/meta/model/MetaProxy.java b/meta/src/main/java/io/art/meta/model/MetaProxy.java index f8643a37c..02cb9f629 100644 --- a/meta/src/main/java/io/art/meta/model/MetaProxy.java +++ b/meta/src/main/java/io/art/meta/model/MetaProxy.java @@ -2,6 +2,8 @@ import io.art.core.annotation.*; import io.art.core.collection.*; + +import static io.art.core.caster.Caster.cast; import static io.art.core.factory.MapFactory.*; import java.util.*; import java.util.function.*; @@ -10,6 +12,22 @@ public abstract class MetaProxy { private final Map, ?>, Function> invocations; + protected void run(Function function) { + function.apply(null); + } + + protected T get(Function function) { + return cast(function.apply(null)); + } + + protected T single(Function function, Object argument) { + return cast(function.apply(argument)); + } + + protected T multiple(Function function, Object[] arguments) { + return cast(function.apply(cast(arguments))); + } + public MetaProxy(Map, ?>, Function> invocations) { this.invocations = invocations; }