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

com.github.dxee.dject.spi.PropertySource Maven / Gradle / Ivy

Go to download

A collection of guice extensions, help to improve the developer experience of guice.

There is a newer version: 1.5.1
Show newest version
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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy