jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1211971 - /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java
Date Thu, 08 Dec 2011 16:50:03 GMT
Author: mduerig
Date: Thu Dec  8 16:50:02 2011
New Revision: 1211971

URL: http://svn.apache.org/viewvc?rev=1211971&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
- add constants boolean values and null
- add remove method for array elements

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java?rev=1211971&r1=1211970&r2=1211971&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsonValue.java
Thu Dec  8 16:50:02 2011
@@ -165,7 +165,7 @@ public abstract class JsonValue {
      * @throws NumberFormatException  on invalid escape sequences
      */
     public static String unescape(String text) {
-        if (text.length()  == 0) {
+        if (text.isEmpty()) {
             return text;
         }
 
@@ -262,6 +262,10 @@ public abstract class JsonValue {
      * {@link Type#STRING} {@link Type#NUMBER} {@link Type#BOOLEAN} and {@link Type#NULL}.
      */
     public static class JsonAtom extends JsonValue {
+        public static JsonAtom NULL = new JsonAtom("null", Type.NULL);
+        public static JsonAtom TRUE = new JsonAtom("true", Type.BOOLEAN);
+        public static JsonAtom FALSE = new JsonAtom("false", Type.BOOLEAN);
+
         private final String value;
         private final Type type;
 
@@ -361,6 +365,15 @@ public abstract class JsonValue {
         }
 
         /**
+         * Removes a value from this array
+         * @param value
+         * @return  {@code true} iff the array contains {@code value}
+         */
+        public boolean remove(JsonValue value) {
+            return values.remove(value);
+        }
+
+        /**
          * @param index
          * @return the {@code JsonValue} at {@code index}.
          * @throws IndexOutOfBoundsException  if {@code index} is out of range



Mime
View raw message