org.hibernate.search.engine.cfg.spi.ConsumedPropertyTrackingConfigurationPropertySource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-engine Show documentation
Show all versions of hibernate-search-engine Show documentation
Hibernate Search engine, always required
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.search.engine.cfg.spi;
import java.util.Optional;
import java.util.function.Consumer;
import org.hibernate.search.engine.cfg.ConfigurationPropertySource;
public final class ConsumedPropertyTrackingConfigurationPropertySource implements ConfigurationPropertySource {
private final ConfigurationPropertySource delegate;
private final Consumer tracker;
public ConsumedPropertyTrackingConfigurationPropertySource(ConfigurationPropertySource delegate,
Consumer tracker) {
this.delegate = delegate;
this.tracker = tracker;
}
@Override
public Optional> get(String key) {
Optional resolved = resolve( key );
if ( resolved.isPresent() ) {
tracker.accept( resolved.get() );
}
return delegate.get( key );
}
@Override
public Optional resolve(String key) {
return delegate.resolve( key );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy