feat(container): add chaining, single method add method for overriding, key getter and protected entries getter
Build / Gradle-Build (push) Successful in 16s
Publish / Gradle-Publish (push) Successful in 12s
Test / Gradle-Test (push) Successful in 12s

This commit is contained in:
tueem committed 2025-04-10 14:44:57 +02:00
1 parent 3deee2fd5d
commit c0da5ee75d
3 files changed
+46 -16

No files matched your search

@@ -6,6 +6,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import net.tomatentum.cutin.ReflectedMethod;
import net.tomatentum.cutin.ReflectedMethodFactory;
@@ -21,15 +22,22 @@ public class LoneMethodContainer<I extends Object> implements MethodContainer<I>
}
@Override
public void addMethods(ReflectedMethod<I>... methods) {
for (ReflectedMethod<I> reflectedMethod : methods)
this.methodStore.put(reflectedMethod.identifier(), reflectedMethod);
public MethodContainer<I> addMethod(ReflectedMethod<I> method) {
this.methodStore.put(method.identifier(), method);
return this;
}
@Override
public void addMethods(Object containingObject, Method... methods) {
public MethodContainer<I> addMethods(Object containingObject, Method... methods) {
for (Method method : methods)
this.addMethods(this.factory.produce(method, containingObject));
this.factory.produce(method, containingObject)
.ifPresent(this::addMethod);
return this;
}
@Override
public Set<I> identifiers() {
return methodStore.keySet();
}
@Override