tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [09/16] incubator-tamaya git commit: Added Configuration.getConfiguratinContext()
Date Sun, 13 Mar 2016 23:59:10 GMT
Added Configuration.getConfiguratinContext()


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/0e3e51d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/0e3e51d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/0e3e51d8

Branch: refs/heads/master
Commit: 0e3e51d8e665614e1299d2c61abbd42b71ae0f7b
Parents: ee8be4c
Author: anatole <anatole@apache.org>
Authored: Mon Mar 14 00:34:09 2016 +0100
Committer: anatole <anatole@apache.org>
Committed: Mon Mar 14 00:34:09 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/tamaya/Configuration.java   | 63 +++-----------------
 .../apache/tamaya/ConfigurationProvider.java    |  2 +
 2 files changed, 10 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0e3e51d8/code/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/Configuration.java b/code/api/src/main/java/org/apache/tamaya/Configuration.java
index d5abfc5..0af0cf4 100644
--- a/code/api/src/main/java/org/apache/tamaya/Configuration.java
+++ b/code/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tamaya;
 
+import org.apache.tamaya.spi.ConfigurationContext;
+
 import java.util.Collections;
 import java.util.Map;
 
@@ -47,61 +49,6 @@ import java.util.Map;
 public interface Configuration {
 
     /**
-     * Empty instance usable, where a configuration is required but no one is avilable.
-     */
-    Configuration EMPTY = new Configuration(){
-        @Override
-        public String get(String key) {
-            return null;
-        }
-
-        @Override
-        public String getOrDefault(String key, String defaultValue) {
-            return defaultValue;
-        }
-
-        @Override
-        public <T> T getOrDefault(String key, Class<T> type, T defaultValue)
{
-            return defaultValue;
-        }
-
-        @Override
-        public <T> T get(String key, Class<T> type) {
-            return null;
-        }
-
-        @Override
-        public <T> T get(String key, TypeLiteral<T> type) {
-            return null;
-        }
-
-        @Override
-        public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue)
{
-            return defaultValue;
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public Configuration with(ConfigOperator operator) {
-            return operator.operate(this);
-        }
-
-        @Override
-        public <T> T query(ConfigQuery<T> query) {
-            return query.query(this);
-        }
-
-        @Override
-        public String toString(){
-            return "Configuration.EMPTY";
-        }
-    };
-
-    /**
      * Access a property.
      *
      * @param key the property's key, not null.
@@ -203,4 +150,10 @@ public interface Configuration {
      */
     <T> T query(ConfigQuery<T> query);
 
+    /**
+     * Access a configuration┼Ł context.
+     * @return the configuration context, never null.
+     */
+    ConfigurationContext getContext();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0e3e51d8/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index fabe0a8..5b9c3f1 100644
--- a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -87,7 +87,9 @@ public final class ConfigurationProvider {
      * Get access to the current ConfigurationContext.
      *
      * @return the current ConfigurationContext, never null.
+     * @deprecated Use {@link Configuration#getContext()} instead of.
      */
+    @Deprecated
     public static ConfigurationContext getConfigurationContext() {
         return PROVIDER_SPI.getConfigurationContext();
     }


Mime
View raw message