01 /*
02 * Copyright 2008-2014 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.ResourceBundle;
22
23 /**
24 * @author Andres Almiray
25 * @since 2.0.0
26 */
27 public interface Configuration {
28 boolean containsKey(@Nonnull String key);
29
30 @Nonnull
31 Map<String, Object> asFlatMap();
32
33 @Nonnull
34 ResourceBundle asResourceBundle();
35
36 @Nullable
37 Object get(@Nonnull String key);
38
39 @Nullable
40 <T> T get(@Nonnull String key, @Nullable T defaultValue);
41
42 @Nullable
43 Object getAt(@Nonnull String key);
44
45 @Nullable
46 <T> T getAt(@Nonnull String key, @Nullable T defaultValue);
47
48 boolean getAsBoolean(@Nonnull String key);
49
50 boolean getAsBoolean(@Nonnull String key, boolean defaultValue);
51
52 int getAsInt(@Nonnull String key);
53
54 int getAsInt(@Nonnull String key, int defaultValue);
55
56 long getAsLong(@Nonnull String key);
57
58 long getAsLong(@Nonnull String key, long defaultValue);
59
60 float getAsFloat(@Nonnull String key);
61
62 float getAsFloat(@Nonnull String key, float defaultValue);
63
64 double getAsDouble(@Nonnull String key);
65
66 double getAsDouble(@Nonnull String key, double defaultValue);
67
68 @Nullable
69 String getAsString(@Nonnull String key);
70
71 @Nullable
72 String getAsString(@Nonnull String key, @Nullable String defaultValue);
73 }
|