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

com.netflix.archaius.api.PropertyContainer Maven / Gradle / Ivy

/**
 * Copyright 2015 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.netflix.archaius.api;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.function.Function;

/**
 * Container for a single property that can be parse as any type.  
 * A PropertyContainer is attached to the Config source from which it
 * was created and receives notification of value changes.  Implementations
 * of Property are non-blocking and optimize updating property values 
 * in the background so as not to incur any overhead during hot call
 * paths.
 * @deprecated Use {@link Property} instead.
 */
@Deprecated
public interface PropertyContainer {
    /**
     * Parse the property as a string 
     */
    Property asString(String defaultValue);
    
    /**
     * Parse the property as an int 
     */
    Property asInteger(Integer defaultValue);
    
    /**
     * Parse the property as a Long 
     */
    Property asLong(Long defaultValue);
    
    /**
     * Parse the property as a double 
     */
    Property asDouble(Double defaultValue);
    
    /**
     * Parse the property as a float 
     */
    Property asFloat(Float defaultValue);
    
    /**
     * Parse the property as a short 
     */
    Property asShort(Short defaultValue);
    
    /**
     * Parse the property as a byte 
     */
    Property asByte(Byte defaultValue);
    
    /**
     * Parse the property as a boolean 
     */
    Property asBoolean(Boolean defaultValue);

    /**
     * Parse the property as a BigDecimal 
     */
    Property asBigDecimal(BigDecimal defaultValue);

    /**
     * Parse the property as a BigInteger 
     */
    Property asBigInteger(BigInteger defaultValue);
    
    /**
     * Custom parsing based on the provided type.  An implementation of ObservableProperty 
     * should be optimized to call one of the known parsing methods based on type. 
     */
     Property asType(Class type, T defaultValue);
    
     Property asType(Function type, String defaultValue);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy