jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1304782 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java
Date Sat, 24 Mar 2012 13:02:34 GMT
Author: jukka
Date: Sat Mar 24 13:02:33 2012
New Revision: 1304782

URL: http://svn.apache.org/viewvc?rev=1304782&view=rev
Log:
OAK-33: Values in oak-core

No need for an explicit type field

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java?rev=1304782&r1=1304781&r2=1304782&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/ScalarImpl.java
Sat Mar 24 13:02:33 2012
@@ -8,7 +8,6 @@ import java.io.UnsupportedEncodingExcept
 import java.util.concurrent.Callable;
 
 public abstract class ScalarImpl implements Scalar {
-    private final Type type;
 
     public static Scalar numberScalar(String value) {
         // todo improve
@@ -57,15 +56,6 @@ public abstract class ScalarImpl impleme
         return new BinaryScalar(valueProvider);
     }
 
-    private ScalarImpl(Type type) {
-        this.type = type;
-    }
-
-    @Override
-    public Type getType() {
-        return type;   
-    }
-
     @Override
     public boolean getBoolean() {
         return Boolean.valueOf(getString());
@@ -94,7 +84,7 @@ public abstract class ScalarImpl impleme
 
     @Override
     public String toString() {
-        return getString() + ": " + type;
+        return getString() + ": " + getType();
     }
 
     //------------------------------------------------------------< private >---
@@ -106,11 +96,15 @@ public abstract class ScalarImpl impleme
         private final boolean value;
 
         public BooleanScalar(boolean value) {
-            super(Type.BOOLEAN);
             this.value = value;
         }
 
         @Override
+        public Type getType() {
+            return Type.BOOLEAN;
+        }
+
+        @Override
         public boolean getBoolean() {
             return value;
         }
@@ -142,8 +136,10 @@ public abstract class ScalarImpl impleme
     private static final NullScalar NULL_SCALAR = new NullScalar();
 
     private static final class NullScalar extends ScalarImpl {
-        protected NullScalar() {
-            super(Type.NULL);
+
+        @Override
+        public Type getType() {
+            return Type.NULL;
         }
 
         @Override
@@ -174,11 +170,15 @@ public abstract class ScalarImpl impleme
         private final long value;
 
         public LongScalar(long value) {
-            super(Type.LONG);
             this.value = value;
         }
 
         @Override
+        public Type getType() {
+            return Type.LONG;
+        }
+
+        @Override
         public long getLong() {
             return value;
         }
@@ -211,11 +211,15 @@ public abstract class ScalarImpl impleme
         private final double value;
 
         public DoubleScalar(double value) {
-            super(Type.DOUBLE);
             this.value = value;
         }
 
         @Override
+        public Type getType() {
+            return Type.DOUBLE;
+        }
+
+        @Override
         public double getDouble() {
             return value;
         }
@@ -249,11 +253,15 @@ public abstract class ScalarImpl impleme
         private final String value;
 
         public StringScalar(String value) {
-            super(Type.STRING);
             this.value = value;
         }
 
         @Override
+        public Type getType() {
+            return Type.STRING;
+        }
+
+        @Override
         public String getString() {
             return value;
         }
@@ -281,11 +289,15 @@ public abstract class ScalarImpl impleme
         private final String value;
 
         public SmallBinaryScalar(String value) {
-            super(Type.BINARY);
             this.value = value;
         }
 
         @Override
+        public Type getType() {
+            return Type.BINARY;
+        }
+
+        @Override
         public String getString() {
             return value;
         }
@@ -313,11 +325,15 @@ public abstract class ScalarImpl impleme
         private final Callable<InputStream> valueProvider;
 
         public BinaryScalar(Callable<InputStream> valueProvider) {
-            super(Type.BINARY);
             this.valueProvider = valueProvider;
         }
 
         @Override
+        public Type getType() {
+            return Type.BINARY;
+        }
+
+        @Override
         public InputStream getInputStream() {
             try {
                 return valueProvider.call();
@@ -351,5 +367,5 @@ public abstract class ScalarImpl impleme
             return getString().hashCode();
         }
     }
-     
+
 }



Mime
View raw message