Class Proxies
java.lang.Object
org.qubership.atp.dataset.db.utils.Proxies
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TWraps an supplier into object type of T.static <T> List<T> Wraps a list into proxy.static <T extends Identified,IdT>
TProxy which obtains a real object using id and sourceFunc on access.
-
Constructor Details
-
Proxies
public Proxies()
-
-
Method Details
-
withId
public static <T extends Identified,IdT> T withId(@Nonnull Class<T> type, @Nonnull IdT id, @Nonnull Function<IdT, ? extends T> sourceFunc) Proxy which obtains a real object using id and sourceFunc on access. MethodsObject.equals(Object),Object.hashCode(),Identified.getId()do not trigger the sourceFunc.- Type Parameters:
T- target- Parameters:
type- target interfaceid- identified object idsourceFunc- explains how to obtain a real instance, should not return null ever- Returns:
- proxy
-
list
Wraps a list into proxy. Seebase(Class, Supplier) -
base
Wraps an supplier into object type of T. Supplier is triggered once on access to object methods.- Type Parameters:
T- target- Parameters:
type- target object typesup- Supplier should not return null ever- Returns:
- proxy
-