You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by po...@apache.org on 2017/11/17 23:04:58 UTC

incubator-tamaya-sandbox git commit: Fixing errors in metamodel

Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/master 9746d0018 -> 31bdbd264


Fixing errors in metamodel

Equals compared the wrong stufff among values,
minor typos/refactorings.


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

Branch: refs/heads/master
Commit: 31bdbd2643274f8eca0e86e457aed7e818fe97fd
Parents: 9746d00
Author: Phil Ottlinger <po...@apache.org>
Authored: Sat Nov 18 00:04:28 2017 +0100
Committer: Phil Ottlinger <po...@apache.org>
Committed: Sat Nov 18 00:04:28 2017 +0100

----------------------------------------------------------------------
 .../org/apache/tamaya/metamodel/MetaContext.java     | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/31bdbd26/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
index 9082fc3..c890148 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/MetaContext.java
@@ -141,7 +141,7 @@ public final class MetaContext {
      * Sets the given context property.
      * @param key the key, not null.
      * @param value the value, not null.
-     * @return the porevious value, or null.
+     * @return the previous value, or null.
      */
     public String setProperty(String key, String value){
        return setProperty(key, value, 0, TimeUnit.MILLISECONDS);
@@ -153,7 +153,7 @@ public final class MetaContext {
      * @param value the value, not null.
      * @param ttl the time to live. Zero or less than zero means, no timeout.
      * @param unit the target time unit.
-     * @return the porevious value, or null.
+     * @return the previous value, or null.
      */
     public String setProperty(String key, String value, int ttl, TimeUnit unit){
         Value previous = this.properties.put(key, new Value(key, value, ttl));
@@ -201,7 +201,7 @@ public final class MetaContext {
      * @param unit the target time unit.
      */
     public void setProperties(Map<String,String> properties, long ttl, TimeUnit unit){
-        for(Map.Entry en:properties.entrySet()) {
+        for(Map.Entry<String, String> en:properties.entrySet()) {
             this.properties.put(
                     en.getKey().toString(),
                     new Value(en.getKey().toString(), en.getValue().toString(), unit.toMillis(ttl)));
@@ -247,7 +247,6 @@ public final class MetaContext {
         MetaContext context = (MetaContext) o;
 
         return getProperties().equals(context.getProperties());
-
     }
 
     @Override
@@ -265,9 +264,9 @@ public final class MetaContext {
     }
 
     private static final class Value{
-        String key;
-        String value;
-        long validUntil;
+        private String key;
+        private String value;
+        private long validUntil;
 
         Value(String key, String value, long ttl){
             this.key = Objects.requireNonNull(key);
@@ -292,7 +291,7 @@ public final class MetaContext {
             if (this == o) return true;
             if (!(o instanceof Value)) return false;
             Value value = (Value) o;
-            return Objects.equals(value, value.value);
+            return Objects.equals(value, this);
         }
 
         @Override