All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.engine.cfg.impl.EmptyConfigurationPropertySource Maven / Gradle / Ivy

There is a newer version: 8.0.0.Alpha1
Show newest version
/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.search.engine.cfg.impl;

import java.util.Optional;

import org.hibernate.search.engine.cfg.ConfigurationPropertySource;

public class EmptyConfigurationPropertySource implements ConfigurationPropertySource {

	private static final EmptyConfigurationPropertySource INSTANCE = new EmptyConfigurationPropertySource();

	public static ConfigurationPropertySource get() {
		return INSTANCE;
	}

	private EmptyConfigurationPropertySource() {
		// Private constructor, use get() instead
	}

	@Override
	public Optional get(String key) {
		return Optional.empty();
	}

	@Override
	public Optional resolve(String key) {
		return Optional.of( key );
	}

	@Override
	public ConfigurationPropertySource withMask(String mask) {
		return this;
	}

	@Override
	public ConfigurationPropertySource withFallback(ConfigurationPropertySource fallback) {
		return fallback;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder( getClass().getSimpleName() )
				.append( "[]" );
		return sb.toString();
	}
}