| 
01 /*02  * Copyright 2008-2015 the original author or authors.
 03  *
 04  * Licensed under the Apache License, Version 2.0 (the "License");
 05  * you may not use this file except in compliance with the License.
 06  * You may obtain a copy of the License at
 07  *
 08  *     http://www.apache.org/licenses/LICENSE-2.0
 09  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16 package griffon.core;
 17
 18 import javax.annotation.Nonnull;
 19 import javax.annotation.Nullable;
 20 import java.util.Map;
 21 import java.util.Properties;
 22 import java.util.ResourceBundle;
 23
 24 /**
 25  * @author Andres Almiray
 26  * @since 2.0.0
 27  */
 28 public interface Configuration {
 29     boolean containsKey(@Nonnull String key);
 30
 31     @Nonnull
 32     Map<String, Object> asFlatMap();
 33
 34     @Nonnull
 35     ResourceBundle asResourceBundle();
 36
 37     @Nonnull
 38     Properties asProperties();
 39
 40     @Nullable
 41     Object get(@Nonnull String key);
 42
 43     @Nullable
 44     <T> T get(@Nonnull String key, @Nullable T defaultValue);
 45
 46     @Nullable
 47     Object getAt(@Nonnull String key);
 48
 49     @Nullable
 50     <T> T getAt(@Nonnull String key, @Nullable T defaultValue);
 51
 52     boolean getAsBoolean(@Nonnull String key);
 53
 54     boolean getAsBoolean(@Nonnull String key, boolean defaultValue);
 55
 56     int getAsInt(@Nonnull String key);
 57
 58     int getAsInt(@Nonnull String key, int defaultValue);
 59
 60     long getAsLong(@Nonnull String key);
 61
 62     long getAsLong(@Nonnull String key, long defaultValue);
 63
 64     float getAsFloat(@Nonnull String key);
 65
 66     float getAsFloat(@Nonnull String key, float defaultValue);
 67
 68     double getAsDouble(@Nonnull String key);
 69
 70     double getAsDouble(@Nonnull String key, double defaultValue);
 71
 72     @Nullable
 73     String getAsString(@Nonnull String key);
 74
 75     @Nullable
 76     String getAsString(@Nonnull String key, @Nullable String defaultValue);
 77 }
 |