feat(container): add chaining, single method add method for overriding, key getter and protected entries getter
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user