THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
@PublicEvolving public interface AsyncLookupFunctionProvider extends LookupTableSource.LookupRuntimeProvider { /** * Creates {@linka AsyncLookupFunctionProvider}builder withof the given {@link AsyncLookupFunction} and * disable lookup table caching. LookupFunctionProvider}. */ static AsyncLookupFunctionProviderBuilder ofnewBuilder(AsyncLookupFunction asyncLookupFunction) { return new AsyncLookupFunctionProvider() { @Override public AsyncLookupFunction createAsyncLookupFunction() { return asyncLookupFunction; } @Override public Optional<LookupCacheFactory> getCacheFactory() { return Optional.empty(); } @Override public Optional<Boolean> cacheMissingKey() { return Optional.empty(); } }; } /** * Creates {@link AsyncLookupFunctionProvider} with the given {@link AsyncLookupFunction} and * enable caching with specified {@link LookupCacheFactory}. */ static AsyncLookupFunctionProvider of( AsyncLookupFunction asyncLookupFunction, LookupCacheFactory cacheBuilder, boolean cacheMissingKey) { return new AsyncLookupFunctionProvider() { @Override public AsyncLookupFunction createAsyncLookupFunction() { return asyncLookupFunction; } @Override public Optional<LookupCacheFactory> getCacheFactory() { return Optional.of(cacheBuilder); } @Override public Optional<Boolean> cacheMissingKey() { return Optional.of(cacheMissingKey); } }Builder(); } /** Creates an {@link AsyncLookupFunction} instance. */ AsyncLookupFunction createAsyncLookupFunction(); /** * Gets the {@link LookupCacheFactory} for creating lookup cache. * * <p>This factory will be used for creating an instance of cache during runtime execution for * optimizing the access to external lookup table. * * @return an {@link Optional} of {@link LookupCacheFactory}, or an empty {@link Optional} if * caching shouldn't be applies to the lookup table. */ Optional<LookupCacheFactory> getCacheFactory(); /** * Whether the missing key (key fields without any matching value rows) should be stored in the * cache. * * <p>Please note that this option is required if {@link #getCacheFactory()} returns a non-empty * instance. If the cache factory is empty, the return value of this function will be ignored. * * @return true if a null or empty value should be stored in the cache. */ Optional<Boolean> cacheMissingKey(); /** Builder class for {@link AsyncLookupFunctionProvider}. */ class Builder { private AsyncLookupFunction asyncLookupFunction; private LookupCacheFactory cacheFactory; private Boolean enableCacheMissingKey; /** Sets lookup function. */ public Builder withAsyncLookupFunction(AsyncLookupFunction asyncLookupFunction) { this.asyncLookupFunction = asyncLookupFunction; return this; } /** Enables caching and sets the cache factory. */ public Builder withCacheFactory(LookupCacheFactory cacheFactory) { this.cacheFactory = cacheFactory; return this; } /** * Enables storing missing key in the cache. * * <p>See {@link AsyncLookupFunctionProvider#cacheMissingKey()} for more details. */ public Builder enableCacheMissingKey() { this.enableCacheMissingKey = true; return this; } public AsyncLookupFunctionProvider build() { // Build AsyncLookupFunctionProvider } } } |
...