com.github.dxee.dject.spi.PropertySource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dject-core Show documentation
Show all versions of dject-core Show documentation
A collection of guice extensions, help to improve the developer experience of guice.
package com.github.dxee.dject.spi;
import com.github.dxee.dject.internal.DefaultPropertySource;
import com.google.inject.ImplementedBy;
/**
* Very simple config interface to be used by Conditional to gain access
* to any type of configuration.
*
* @see DefaultPropertySource
*/
@ImplementedBy(DefaultPropertySource.class)
public interface PropertySource {
/**
* Get the value of a property or null if not found
*
* @param key Name of property to fetch
* @return Value or null if not found
*/
public String get(String key);
/**
* Get the value of a property or default if not found
*
* @param key Name of property to fetch
* @param defaultValue
* @return Value or defaultValue if not found
*/
public String get(String key, String defaultValue);
/**
* Get a property value of a specific type
*
* @param key Name of property to fetch
* @param type Type of value requested
* @return Value of the request type or null if not found
*/
public T get(String key, Class type);
/**
* Get a property value of a specific type while returning a
* default value if the property is not set.
*
* @param key Name of property to fetch
* @param type Type of value requested
* @param defaultValue Default value to return if key not found
* @return Value or defaultValue if not found
*/
public T get(String key, Class type, T defaultValue);
/**
* Determine if the PropertySource contains the specified property key
*/
boolean hasProperty(String key);
}