Class ProxyDelegateFactory
java.lang.Object
ru.progrm_jarvis.javacommons.delegate.ProxyDelegateFactory
- All Implemented Interfaces:
DelegateFactory
Implementation of
delegate factory which uses runtime proxy generation via Proxy.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull DelegateFactorycreate()Creates a proxy-baseddelegate factory.<T> TcreateWrapper(@NonNull Class<T> targetType, @NonNull Supplier<T> supplier) Creates a delegating wrapper of the given type using the providedSupplierfor its backend.
-
Constructor Details
-
ProxyDelegateFactory
@Internal public ProxyDelegateFactory()Creates aProxy-baseddelegate factory.- This constructor is only visible for Java SPI consider using
preferred creation method
-
-
Method Details
-
create
Creates a proxy-baseddelegate factory.- Returns:
- proxy-based delegate factory
- API note
- singleton may be used here
-
createWrapper
@NotNull public <T> T createWrapper(@NonNull @NonNull Class<T> targetType, @NonNull @NonNull Supplier<T> supplier) Description copied from interface:DelegateFactoryCreates a delegating wrapper of the given type using the providedSupplierfor its backend.- Specified by:
createWrapperin interfaceDelegateFactory- Type Parameters:
T- type of implemented wrapper- Parameters:
targetType- type of implemented wrappersupplier- supplier to handle access to the underlying object- Returns:
- created delegating wrapper for the given supplier
-