Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbashir committed Jul 7, 2024
1 parent 667a24f commit c2280b6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions meta/src/main/java/io/art/meta/model/MetaProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -10,6 +12,22 @@
public abstract class MetaProxy {
private final Map<MetaMethod<MetaClass<?>, ?>, Function<Object, Object>> invocations;

protected void run(Function<Object, Object> function) {
function.apply(null);
}

protected <T> T get(Function<Object, Object> function) {
return cast(function.apply(null));
}

protected <T> T single(Function<Object, Object> function, Object argument) {
return cast(function.apply(argument));
}

protected <T> T multiple(Function<Object, Object> function, Object[] arguments) {
return cast(function.apply(cast(arguments)));
}

public MetaProxy(Map<MetaMethod<MetaClass<?>, ?>, Function<Object, Object>> invocations) {
this.invocations = invocations;
}
Expand Down

0 comments on commit c2280b6

Please sign in to comment.