Interface BaseDelegate<T extends BaseDelegate<? extends T>>
- All Known Subinterfaces:
ConcurrentBaseDelegate<T>
- All Known Implementing Classes:
ExecutorFactory,FrameStack,RuleExecutorFactory
public interface BaseDelegate<T extends BaseDelegate<? extends T>>
Convenience interface for classes which may have a parent ("base")
in order to delegate failed operations to (for example, variable lookups).
Please note that such a strategy requires synchronisation or immutability
in concurrent use cases. For example, if a collection in the parent is
modified when a lookup is being delegated by a child, this can lead to
ConcurrentModificationException. To mitigate this,
a synchronized version of delegate methods are provided.- Since:
- 1.6
- Author:
- Sina Madani
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault <R> RdelegateLookup(Function<T, R> method) default <R> RdelegateLookup(Function<T, R> method, boolean syncOnBase) default <R> Rstatic <T,R> R delegateLookup(Function<T, R> method, T... instances) static <T,R> R delegateLookup(Function<T, R> method, T thisObj, T baseObj, Object lock) getBase()default Tdefault TgetTo(BaseDelegate.MergeMode mode) voidmerge(BaseDelegate.MergeMode mode) default <C> voidmergeCollectionsUnique(Function<T, Collection<C>> colPropertyGetter, Supplier<? extends Collection<C>> targetColSup, BaseDelegate.MergeMode mode)
-
Method Details
-
getBase
T getBase() -
merge
-
getFrom
-
getTo
-
mergeCollectionsUnique
default <C> void mergeCollectionsUnique(Function<T, Collection<C>> colPropertyGetter, Supplier<? extends Collection<C>> targetColSup, BaseDelegate.MergeMode mode) -
delegateLookup
-
delegateLookup
-
delegateLookup
-
delegateLookup
-
delegateLookup
-