You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by sa...@apache.org on 2015/07/20 13:43:35 UTC
incubator-johnzon git commit: Skeleton for JSR 374/367,
Mutable Json Structure introduced
Repository: incubator-johnzon
Updated Branches:
refs/heads/jsr374_367 [created] 01b412b80
Skeleton for JSR 374/367, Mutable Json Structure introduced
Project: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/commit/01b412b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/tree/01b412b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/diff/01b412b8
Branch: refs/heads/jsr374_367
Commit: 01b412b805f3ff0561eeea2bb1b901d9ad6e5500
Parents: e63016c
Author: Hendrik Saly <he...@gmail.com>
Authored: Mon Jul 20 13:40:30 2015 +0200
Committer: Hendrik Saly <he...@gmail.com>
Committed: Mon Jul 20 13:40:30 2015 +0200
----------------------------------------------------------------------
.travis.yml | 3 -
johnzon-core/pom.xml | 2 +-
.../johnzon/core/JsonArrayBuilderImpl.java | 144 +++++
.../johnzon/core/JsonBuilderFactoryImpl.java | 14 +
.../johnzon/core/JsonObjectBuilderImpl.java | 12 +
.../org/apache/johnzon/core/JsonWriterImpl.java | 7 +
johnzon-distribution/pom.xml | 12 +-
johnzon-jaxrs/pom.xml | 2 +-
johnzon-mapper/pom.xml | 2 +-
johnzon-mutable/pom.xml | 42 ++
.../core/AbstractMutableJsonStructure.java | 363 +++++++++++
.../org/apache/johnzon/core/AncestorImpl.java | 84 +++
.../org/apache/johnzon/core/CoreHelper.java | 100 +++
.../apache/johnzon/core/GenericJsonValue.java | 128 ++++
.../apache/johnzon/core/MutableJsonArray.java | 243 +++++++
.../apache/johnzon/core/MutableJsonObject.java | 233 +++++++
.../johnzon/mutable/MutableJsonStructure.java | 626 +++++++++++++++++++
.../mutable/MutableJsonStructureFactory.java | 57 ++
johnzon-websocket/pom.xml | 2 +-
pom.xml | 16 +-
20 files changed, 2072 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e94f997..8aaf671 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,6 @@
language: java
jdk:
- - openjdk6
- - openjdk7
- - oraclejdk7
- oraclejdk8
after_success:
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-core/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-core/pom.xml b/johnzon-core/pom.xml
index b52a1a3..95e770d 100644
--- a/johnzon-core/pom.xml
+++ b/johnzon-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>johnzon</artifactId>
<groupId>org.apache.johnzon</groupId>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-core/src/main/java/org/apache/johnzon/core/JsonArrayBuilderImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonArrayBuilderImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonArrayBuilderImpl.java
index 5dfd839..6110249 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonArrayBuilderImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonArrayBuilderImpl.java
@@ -127,4 +127,148 @@ class JsonArrayBuilderImpl implements JsonArrayBuilder, Serializable {
private static NullPointerException npe() {
throw new NullPointerException("value/builder must not be null");
}
+
+ @Override
+ public JsonArrayBuilder addAll(JsonArrayBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, JsonValue value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, String value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, BigDecimal value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, BigInteger value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, int value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, long value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, double value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, boolean value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder addNull(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, JsonObjectBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder add(int index, JsonArrayBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, JsonValue value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, String value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, BigDecimal value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, BigInteger value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, int value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, long value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, double value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, boolean value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder setNull(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, JsonObjectBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder set(int index, JsonArrayBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder remove(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-core/src/main/java/org/apache/johnzon/core/JsonBuilderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonBuilderFactoryImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonBuilderFactoryImpl.java
index 121f18f..21b45ce 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonBuilderFactoryImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonBuilderFactoryImpl.java
@@ -25,8 +25,10 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
+import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
import javax.json.JsonBuilderFactory;
+import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
class JsonBuilderFactoryImpl implements JsonBuilderFactory {
@@ -64,4 +66,16 @@ class JsonBuilderFactoryImpl implements JsonBuilderFactory {
public Map<String, ?> getConfigInUse() {
return Collections.unmodifiableMap(internalConfig);
}
+
+ @Override
+ public JsonObjectBuilder createObjectBuilder(JsonObject object) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonArrayBuilder createArrayBuilder(JsonArray array) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-core/src/main/java/org/apache/johnzon/core/JsonObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonObjectBuilderImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonObjectBuilderImpl.java
index ea15a17..68677c4 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonObjectBuilderImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonObjectBuilderImpl.java
@@ -128,4 +128,16 @@ class JsonObjectBuilderImpl implements JsonObjectBuilder, Serializable {
}
+
+ @Override
+ public JsonObjectBuilder addAll(JsonObjectBuilder builder) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JsonObjectBuilder remove(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-core/src/main/java/org/apache/johnzon/core/JsonWriterImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonWriterImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonWriterImpl.java
index e012ae1..5c14b3f 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonWriterImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonWriterImpl.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonStructure;
+import javax.json.JsonValue;
import javax.json.JsonWriter;
import javax.json.stream.JsonGenerator;
@@ -70,4 +71,10 @@ class JsonWriterImpl implements JsonWriter, Serializable{
}
}
+
+ @Override
+ public void write(JsonValue value) {
+ // TODO Auto-generated method stub
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-distribution/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-distribution/pom.xml b/johnzon-distribution/pom.xml
index c329803..4c93815 100644
--- a/johnzon-distribution/pom.xml
+++ b/johnzon-distribution/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>johnzon</artifactId>
<groupId>org.apache.johnzon</groupId>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -31,25 +31,25 @@
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
+ <artifactId>geronimo-json_1.1_spec</artifactId>
<version>${jsonspecversion}</version>
<scope>compile</scope>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
+ <artifactId>geronimo-json_1.1_spec</artifactId>
<version>${jsonspecversion}</version>
<scope>compile</scope>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
+ <artifactId>geronimo-json_1.1_spec</artifactId>
<version>${jsonspecversion}</version>
<scope>compile</scope>
<classifier>javadoc</classifier>
</dependency>
-
+-->
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-jaxrs/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-jaxrs/pom.xml b/johnzon-jaxrs/pom.xml
index a5472aa..cd6045c 100644
--- a/johnzon-jaxrs/pom.xml
+++ b/johnzon-jaxrs/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>johnzon</artifactId>
<groupId>org.apache.johnzon</groupId>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mapper/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-mapper/pom.xml b/johnzon-mapper/pom.xml
index 8a9db9a..d80ef0b 100644
--- a/johnzon-mapper/pom.xml
+++ b/johnzon-mapper/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>johnzon</artifactId>
<groupId>org.apache.johnzon</groupId>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-mutable/pom.xml b/johnzon-mutable/pom.xml
new file mode 100644
index 0000000..60f08bf
--- /dev/null
+++ b/johnzon-mutable/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>johnzon</artifactId>
+ <groupId>org.apache.johnzon</groupId>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>johnzon-mutable</artifactId>
+ <name>Johnzon :: Mutable/DSL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.johnzon</groupId>
+ <artifactId>johnzon-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <staging.directory>${project.parent.reporting.outputDirectory}</staging.directory>
+ </properties>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/AbstractMutableJsonStructure.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/AbstractMutableJsonStructure.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/AbstractMutableJsonStructure.java
new file mode 100644
index 0000000..715f0cd
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/AbstractMutableJsonStructure.java
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import java.util.Set;
+
+import javax.json.JsonException;
+import javax.json.JsonNumber;
+import javax.json.JsonString;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+import javax.json.JsonValue.ValueType;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+
+/**
+ *
+ *
+ */
+abstract class AbstractMutableJsonStructure implements MutableJsonStructure {
+
+ private final ValueType valueType;
+ private final Ancestor ancestor;
+
+ AbstractMutableJsonStructure(final ValueType valueType, final Ancestor ancestor) {
+ if (valueType == null) {
+ throw new IllegalArgumentException();
+ }
+
+ this.valueType = valueType;
+ this.ancestor = ancestor;
+ throwIfNotStructure();
+
+ }
+
+ @Override
+ public final Ancestor getAncestor() {
+ return ancestor;
+ }
+
+ @Override
+ public JsonStructure toJsonStructure() {
+ throwIfNotStructure();
+ return null;
+ }
+
+ @Override
+ public int size() {
+ throwIfNotStructure();
+ return -1;
+ }
+
+ @Override
+ public Set<String> getKeys() {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure get(final String key) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure set(final String key, final MutableJsonStructure value) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure remove(final String key) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final String key, final MutableJsonStructure value) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure get(final int index) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure set(final int index, final MutableJsonStructure value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure remove(final int index) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final int index, final MutableJsonStructure value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final MutableJsonStructure value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure set(final int index, final JsonValue value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final int index, final JsonValue value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure set(final String key, final JsonValue value) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final String key, final JsonValue value) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public MutableJsonStructure add(final JsonValue value) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @Override
+ public final MutableJsonStructure set(final String key, final String value) {
+ throwIfNotObject();
+ return set(key, CoreHelper.createJsonString(value));
+ }
+
+ @Override
+ public final MutableJsonStructure set(final String key, final Number value) {
+ throwIfNotObject();
+ return set(key, CoreHelper.createJsonNumber(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final String key, final String value) {
+ throwIfNotObject();
+ return add(key, CoreHelper.createJsonString(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final String key, final Number value) {
+ throwIfNotObject();
+ return add(key, CoreHelper.createJsonNumber(value));
+ }
+
+ @Override
+ public final MutableJsonStructure set(final int index, final String value) {
+ throwIfNotArray();
+ return set(index, CoreHelper.createJsonString(value));
+ }
+
+ @Override
+ public final MutableJsonStructure set(final int index, final Number value) {
+ throwIfNotArray();
+ return set(index, CoreHelper.createJsonNumber(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final int index, final String value) {
+ throwIfNotArray();
+ return add(index, CoreHelper.createJsonString(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final int index, final Number value) {
+ throwIfNotArray();
+ return add(index, CoreHelper.createJsonNumber(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final String value) {
+ throwIfNotArray();
+ return add(CoreHelper.createJsonString(value));
+ }
+
+ @Override
+ public final MutableJsonStructure add(final Number value) {
+ throwIfNotArray();
+ return add(CoreHelper.createJsonNumber(value));
+ }
+
+ @Override
+ public boolean isJsonArray() {
+ throwIfNotStructure();
+ return isArray();
+ }
+
+ @Override
+ public String getLeafAsString(final String key) {
+ return JsonString.class.cast(getLeaf(key)).getString();
+ }
+
+ @Override
+ public int getLeafAsInt(final String key) {
+ return JsonNumber.class.cast(getLeaf(key)).intValueExact();
+ }
+
+ @Override
+ public boolean getLeafAsBoolean(final String key) {
+ final JsonValue val = getLeaf(key);
+ switch (val.getValueType()) {
+ case TRUE:
+ return true;
+ case FALSE:
+ return false;
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+ @Override
+ public boolean isLeafNull(final String key) {
+ final JsonValue val = getLeaf(key);
+ switch (val.getValueType()) {
+ case NULL:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public String getLeafAsString(final int index) {
+ return JsonString.class.cast(getLeaf(index)).getString();
+ }
+
+ @Override
+ public int getLeafAsInt(final int index) {
+ return JsonNumber.class.cast(getLeaf(index)).intValueExact();
+ }
+
+ @Override
+ public boolean getLeafAsBoolean(final int index) {
+ final JsonValue val = getLeaf(index);
+ switch (val.getValueType()) {
+ case TRUE:
+ return true;
+ case FALSE:
+ return false;
+ default:
+ throw new ClassCastException();
+ }
+ }
+
+ @Override
+ public boolean isLeafNull(final int index) {
+ final JsonValue val = getLeaf(index);
+ switch (val.getValueType()) {
+ case NULL:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ protected final boolean isObject() {
+ return valueType.equals(ValueType.OBJECT);
+ }
+
+ protected final boolean isArray() {
+ return valueType.equals(ValueType.ARRAY);
+ }
+
+ protected final boolean isStructure() {
+ return isArray() || isObject();
+ }
+
+ protected final void throwIfNotStructure() {
+ if (!isStructure()) {
+ throw new JsonException("Only valid for structure");
+ }
+ }
+
+ protected final void throwIfNotArray() {
+ if (!isArray()) {
+ throw new JsonException("Only valid for array");
+ }
+ }
+
+ protected final void throwIfNotObject() {
+ if (!isObject()) {
+ throw new JsonException("Only valid for object");
+ }
+ }
+
+ @Override
+ public MutableJsonStructure getParent() {
+ if (ancestor == null) {
+ return null;
+ }
+
+ return ancestor.getMutableJsonStructure();
+ }
+
+ @Override
+ public boolean exists(final String key) {
+ return getKeys().contains(key);
+ }
+
+ @Override
+ public boolean exists(final int index) {
+ return index < size();
+ }
+
+ @Override
+ public MutableJsonStructure copy() {
+ //can be done better, not very performant here
+ return CoreHelper.toMutableJsonStructure0(toJsonStructure());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/AncestorImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/AncestorImpl.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/AncestorImpl.java
new file mode 100644
index 0000000..011cacf
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/AncestorImpl.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+import org.apache.johnzon.mutable.MutableJsonStructure.Ancestor;
+
+/**
+ *
+ *
+ */
+final class AncestorImpl implements Ancestor {
+
+ private final MutableJsonStructure mutableJsonStructure;
+ private final int index;
+ private final String key;
+
+ AncestorImpl(final MutableJsonStructure mutableJsonStructure, final String key) {
+ super();
+
+ if (mutableJsonStructure == null || mutableJsonStructure.isJsonArray()) {
+ throw new IllegalArgumentException();
+ }
+
+ this.mutableJsonStructure = mutableJsonStructure;
+ this.index = -1;
+ this.key = key;
+ }
+
+ AncestorImpl(final MutableJsonStructure mutableJsonStructure, final int index) {
+ super();
+
+ if (mutableJsonStructure == null || !mutableJsonStructure.isJsonArray()) {
+ throw new IllegalArgumentException();
+ }
+
+ this.mutableJsonStructure = mutableJsonStructure;
+ this.index = index;
+ this.key = null;
+ }
+
+ @Override
+ public MutableJsonStructure getMutableJsonStructure() {
+ return mutableJsonStructure;
+ }
+
+ @Override
+ public boolean isJsonArray() {
+ return mutableJsonStructure.isJsonArray();
+ }
+
+ @Override
+ public int getIndex() {
+ return index;
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public String toString() {
+ return isJsonArray() ? String.valueOf(index) : key;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/CoreHelper.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/CoreHelper.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/CoreHelper.java
new file mode 100644
index 0000000..7634e20
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/CoreHelper.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.json.JsonArray;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
+import javax.json.JsonString;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+import org.apache.johnzon.mutable.MutableJsonStructure.Ancestor;
+
+@Experimental
+public class CoreHelper {
+
+ protected CoreHelper() {
+
+ }
+
+ static JsonString createJsonString(final String value) {
+ return new JsonStringImpl(value);
+ }
+
+ static JsonNumber createJsonNumber(final Number number) {
+
+ if (number instanceof BigDecimal) {
+ return new JsonNumberImpl((BigDecimal) number);
+ } else if (number instanceof BigInteger) {
+ return new JsonNumberImpl(new BigDecimal(((BigInteger) number)));
+ } else if (number instanceof Double) {
+ return new JsonDoubleImpl((Double) number);
+ } else if (number instanceof Float) {
+ return new JsonDoubleImpl((Float) number);
+ } else if (number instanceof Long) {
+ return new JsonLongImpl((Long) number);
+ } else {
+ return new JsonLongImpl(number.intValue());
+ }
+
+ }
+
+ protected static MutableJsonStructure toMutableJsonStructure0(final JsonStructure structure) {
+ if (structure instanceof JsonArray) {
+ return new MutableJsonArray((JsonArray) structure, null);
+ }
+
+ return new MutableJsonObject((JsonObject) structure, null);
+ }
+
+ static MutableJsonStructure toMutableJsonStructure(final JsonStructure structure, final Ancestor ac) {
+ if (structure instanceof JsonArray) {
+ return new MutableJsonArray((JsonArray) structure, ac);
+ }
+
+ return new MutableJsonObject((JsonObject) structure, ac);
+ }
+
+ /**
+ * Create new empty mutable JSON object
+ *
+ * @return new empty mutable JSON object
+ */
+ protected static MutableJsonStructure createNewMutableObject0() {
+ // implementation is not performant, could be done better
+ return toMutableJsonStructure0(JsonValue.EMPTY_JSON_OBJECT).copy();
+ }
+
+ /**
+ * Create new empty mutable JSON array
+ *
+ * @return new empty mutable JSON array
+ */
+ protected static MutableJsonStructure createNewMutableArray0() {
+ // implementation is not performant, could be done better
+ return toMutableJsonStructure0(JsonValue.EMPTY_JSON_ARRAY).copy();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/GenericJsonValue.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/GenericJsonValue.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/GenericJsonValue.java
new file mode 100644
index 0000000..68762d4
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/GenericJsonValue.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+import org.apache.johnzon.mutable.MutableJsonStructure.Ancestor;
+
+/**
+ *
+ *
+ */
+final class GenericJsonValue {
+
+ private final JsonValue jsonValue;
+ private final MutableJsonStructure mutableStructure;
+ private final Ancestor ancestor;
+
+ GenericJsonValue(final MutableJsonStructure mutableStructure) {
+ super();
+
+ if (mutableStructure == null) {
+ throw new IllegalArgumentException();
+ }
+
+ this.mutableStructure = mutableStructure;
+ this.jsonValue = null;
+ this.ancestor = null;
+ }
+
+ GenericJsonValue(final JsonValue jsonValue, final Ancestor ancestor) {
+ super();
+
+ if (jsonValue == null) {
+ throw new IllegalArgumentException("jsonValue must not be null");
+ }
+
+ if (jsonValue.getValueType().equals(JsonValue.ValueType.ARRAY) || jsonValue.getValueType().equals(JsonValue.ValueType.OBJECT)) {
+ //convert to mutable;
+ this.ancestor = null;
+ this.jsonValue = null;
+ this.mutableStructure = CoreHelper.toMutableJsonStructure0((JsonStructure) jsonValue);
+ } else {
+
+ this.ancestor = ancestor;
+ this.jsonValue = jsonValue;
+ this.mutableStructure = null;
+ }
+ }
+
+ public boolean isJsonValue() {
+ return jsonValue != null;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((jsonValue == null) ? 0 : jsonValue.hashCode());
+ result = prime * result + ((mutableStructure == null) ? 0 : mutableStructure.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final GenericJsonValue other = (GenericJsonValue) obj;
+ if (jsonValue == null) {
+ if (other.jsonValue != null) {
+ return false;
+ }
+ } else if (!jsonValue.equals(other.jsonValue)) {
+ return false;
+ }
+ if (mutableStructure == null) {
+ if (other.mutableStructure != null) {
+ return false;
+ }
+ } else if (!mutableStructure.equals(other.mutableStructure)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return isJsonValue() ? jsonValue.toString() : mutableStructure.toString();
+ }
+
+ public JsonValue getJsonValue() {
+ return jsonValue;
+ }
+
+ public MutableJsonStructure getMutableStructure() {
+ return mutableStructure;
+ }
+
+ public Ancestor getAncestor() {
+ return ancestor;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonArray.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonArray.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonArray.java
new file mode 100644
index 0000000..f32819c
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonArray.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonException;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+
+final class MutableJsonArray extends AbstractMutableJsonStructure {
+
+ private final List<GenericJsonValue> mutableList;
+
+ MutableJsonArray(final JsonArray list, final Ancestor ancestor) {
+ super(JsonValue.ValueType.ARRAY, ancestor);
+
+ mutableList = new ArrayList<GenericJsonValue>();
+
+ int i = 0;
+ for (final Iterator iterator = list.iterator(); iterator.hasNext();) {
+ final JsonValue value = (JsonValue) iterator.next();
+ final Ancestor ca = new AncestorImpl(this, i);
+
+ if (value.getValueType().equals(JsonValue.ValueType.ARRAY)) {
+ mutableList.add(new GenericJsonValue(CoreHelper.toMutableJsonStructure((JsonStructure) value, ca)));
+ } else if (value.getValueType().equals(JsonValue.ValueType.OBJECT)) {
+ mutableList.add(new GenericJsonValue(CoreHelper.toMutableJsonStructure((JsonStructure) value, ca)));
+ } else {
+ mutableList.add(new GenericJsonValue(value, ca));
+ }
+ i++;
+ }
+ }
+
+ @Override
+ public JsonValue getLeaf(final int index) {
+ throwIfNotArray();
+ try {
+ final GenericJsonValue genericJsonValue = mutableList.get(index);
+ if (genericJsonValue.isJsonValue()) {
+ return genericJsonValue.getJsonValue();
+ }
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+
+ throw new JsonException("not a value");
+ }
+
+ @Override
+ public final MutableJsonStructure set(final int index, final JsonValue value) {
+ throwIfNotArray();
+ try {
+ mutableList.set(index, new GenericJsonValue(value, getAncestor()));
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+ return this;
+ }
+
+ @Override
+ public final MutableJsonStructure add(final int index, final JsonValue value) {
+ throwIfNotArray();
+ try {
+ mutableList.add(index, new GenericJsonValue(value, getAncestor()));
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+ return this;
+ }
+
+ @Override
+ public final MutableJsonStructure add(final JsonValue value) {
+ throwIfNotArray();
+ mutableList.add(new GenericJsonValue(value, getAncestor()));
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure get(final int index) {
+ try {
+ final GenericJsonValue genericJsonValue = mutableList.get(index);
+ if (!genericJsonValue.isJsonValue()) {
+ return genericJsonValue.getMutableStructure();
+ }
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+
+ throw new JsonException("not a mutable structure");
+ }
+
+ @Override
+ public MutableJsonStructure set(final int index, final MutableJsonStructure value) {
+ try {
+ mutableList.set(index, new GenericJsonValue(value));
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure remove(final int index) {
+ try {
+ mutableList.remove(index);
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure add(final int index, final MutableJsonStructure value) {
+ try {
+ mutableList.add(index, new GenericJsonValue(value));
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure add(final MutableJsonStructure value) {
+ mutableList.add(new GenericJsonValue(value));
+ return this;
+ }
+
+ @Override
+ public JsonStructure toJsonStructure() {
+
+ final JsonArrayBuilder builder = Json.createArrayBuilder();
+
+ for (final Iterator<GenericJsonValue> iterator = mutableList.iterator(); iterator.hasNext();) {
+ final GenericJsonValue genericJsonValue = iterator.next();
+
+ if (genericJsonValue.isJsonValue()) {
+ builder.add(genericJsonValue.getJsonValue());
+ } else {
+ builder.add(genericJsonValue.getMutableStructure().toJsonStructure());
+ }
+
+ }
+
+ return builder.build();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((mutableList == null) ? 0 : mutableList.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final MutableJsonArray other = (MutableJsonArray) obj;
+ if (mutableList == null) {
+ if (other.mutableList != null) {
+ return false;
+ }
+ } else if (!mutableList.equals(other.mutableList)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return this.toJsonStructure().toString();
+ }
+
+ @Override
+ public int size() {
+ return mutableList.size();
+ }
+
+ @Override
+ public JsonValue getLeaf(@SuppressWarnings("unused") final String key) {
+ throwIfNotObject();
+ return null;
+ }
+
+ @Override
+ public boolean isLeaf(final int index) {
+ GenericJsonValue genericJsonValue = null;
+ try {
+ genericJsonValue = mutableList.get(index);
+ } catch (final IndexOutOfBoundsException e) {
+ throw new JsonException("invalid index " + index);
+ }
+
+ return genericJsonValue.isJsonValue();
+ }
+
+ @Override
+ public boolean isLeaf(final String key) {
+ throwIfNotObject();
+ throw new RuntimeException("cannot happen");
+ }
+
+ @Override
+ public MutableJsonStructure set(final MutableJsonStructure value) {
+ mutableList.clear();
+ mutableList.addAll(((MutableJsonArray) value).mutableList);
+ return this;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonObject.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonObject.java b/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonObject.java
new file mode 100644
index 0000000..d31b520
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/core/MutableJsonObject.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.core;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.json.Json;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+
+import org.apache.johnzon.mutable.MutableJsonStructure;
+
+final class MutableJsonObject extends AbstractMutableJsonStructure {
+
+ private final Map<String, GenericJsonValue> mutableMap;
+
+ MutableJsonObject(final JsonObject map, final Ancestor ancestor) {
+ super(JsonValue.ValueType.OBJECT, ancestor);
+
+ this.mutableMap = new LinkedHashMap<String, GenericJsonValue>();
+
+ for (final Iterator<Entry<String, JsonValue>> iterator = map.entrySet().iterator(); iterator.hasNext();) {
+ final Entry<String, JsonValue> entry = iterator.next();
+ final JsonValue value = entry.getValue();
+ final Ancestor ca = new AncestorImpl(this, entry.getKey());
+
+ if (value.getValueType().equals(JsonValue.ValueType.ARRAY)) {
+ mutableMap.put(entry.getKey(), new GenericJsonValue(CoreHelper.toMutableJsonStructure((JsonStructure) value, ca)));
+ } else if (value.getValueType().equals(JsonValue.ValueType.OBJECT)) {
+ mutableMap.put(entry.getKey(), new GenericJsonValue(CoreHelper.toMutableJsonStructure((JsonStructure) value, ca)));
+ } else {
+ mutableMap.put(entry.getKey(), new GenericJsonValue(value, ca));
+ }
+
+ }
+
+ }
+
+ @Override
+ public JsonValue getLeaf(final String key) {
+ throwIfNotObject();
+
+ if (!mutableMap.containsKey(key)) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ final GenericJsonValue genericJsonValue = mutableMap.get(key);
+ if (genericJsonValue.isJsonValue()) {
+ return genericJsonValue.getJsonValue();
+ }
+
+ throw new JsonException("not a value");
+
+ }
+
+ @Override
+ public final MutableJsonStructure set(final String key, final JsonValue value) {
+ throwIfNotObject();
+
+ if (!mutableMap.containsKey(key)) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ mutableMap.put(key, new GenericJsonValue(value, getAncestor()));
+ return this;
+ }
+
+ @Override
+ public final MutableJsonStructure add(final String key, final JsonValue value) {
+ throwIfNotObject();
+ mutableMap.put(key, new GenericJsonValue(value, getAncestor()));
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure get(final String key) {
+ final GenericJsonValue genericJsonValue = mutableMap.get(key);
+
+ if (genericJsonValue == null) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ if (!genericJsonValue.isJsonValue()) {
+ return genericJsonValue.getMutableStructure();
+ }
+
+ throw new JsonException("not a mutable structure, " + genericJsonValue);
+ }
+
+ @Override
+ public MutableJsonStructure set(final String key, final MutableJsonStructure value) {
+
+ if (!mutableMap.containsKey(key)) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ mutableMap.put(key, new GenericJsonValue(value));
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure remove(final String key) {
+
+ if (!mutableMap.containsKey(key)) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ mutableMap.remove(key);
+ return this;
+ }
+
+ @Override
+ public MutableJsonStructure add(final String key, final MutableJsonStructure value) {
+ mutableMap.put(key, new GenericJsonValue(value));
+ return this;
+ }
+
+ @Override
+ public JsonStructure toJsonStructure() {
+ final JsonObjectBuilder builder = Json.createObjectBuilder();
+
+ for (final Iterator<Entry<String, GenericJsonValue>> iterator = mutableMap.entrySet().iterator(); iterator.hasNext();) {
+ final Entry<String, GenericJsonValue> entry = iterator.next();
+
+ if (entry.getValue().isJsonValue()) {
+ builder.add(entry.getKey(), entry.getValue().getJsonValue());
+ } else {
+ builder.add(entry.getKey(), entry.getValue().getMutableStructure().toJsonStructure());
+ }
+ }
+
+ return builder.build();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((mutableMap == null) ? 0 : mutableMap.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final MutableJsonObject other = (MutableJsonObject) obj;
+ if (mutableMap == null) {
+ if (other.mutableMap != null) {
+ return false;
+ }
+ } else if (!mutableMap.equals(other.mutableMap)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return this.toJsonStructure().toString();
+ }
+
+ @Override
+ public int size() {
+ return mutableMap.size();
+ }
+
+ @Override
+ public Set<String> getKeys() {
+ return mutableMap.keySet();
+ }
+
+ @Override
+ public JsonValue getLeaf(@SuppressWarnings("unused") final int index) {
+ throwIfNotArray();
+ return null;
+ }
+
+ @Override
+ public boolean isLeaf(@SuppressWarnings("unused") final int index) {
+ throwIfNotArray();
+ throw new RuntimeException("cannot happen");
+ }
+
+ @Override
+ public boolean isLeaf(final String key) {
+
+ if (!mutableMap.containsKey(key)) {
+ throw new JsonException("no such key: '" + key + "'");
+ }
+
+ final GenericJsonValue genericJsonValue = mutableMap.get(key);
+ return genericJsonValue.isJsonValue();
+ }
+
+ @Override
+ public MutableJsonStructure set(final MutableJsonStructure value) {
+ mutableMap.clear();
+ mutableMap.putAll(((MutableJsonObject) value).mutableMap);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructure.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructure.java b/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructure.java
new file mode 100644
index 0000000..a8abc6b
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructure.java
@@ -0,0 +1,626 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.mutable;
+
+import java.util.Set;
+
+
+//CHECKSTYLE:OFF
+import javax.json.JsonException;
+//CHECKSTYLE:ON
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+
+import org.apache.johnzon.core.Experimental;
+
+/**
+ * A mutable and navigable object representation of a JSON text.
+ * <p>
+ * The leafs of this tree are immutable JsonValues and are never of {@code JsonValue.ValueType} ARRAY or OBJECT but NUMBER or STRING or TRUE
+ * or FALSE or NULL.
+ * <p>
+ * The mutation methods provides functionality for
+ *
+ * <ul>
+ * <li>adding either a {@code JsonValue} or a {@code MutableJsonStructure} through <code>add()</code></li>
+ * <li>setting either a {@code JsonValue} or a {@code MutableJsonStructure} through <code>set()</code></li>
+ * <li>removing either a {@code JsonValue} or a {@code MutableJsonStructure} through <code>remove()</code></li>
+ * </ul>
+ *
+ * <p>
+ * The basic usage pattern for this class is:
+ *
+ * <pre>
+ * <code>
+ * JsonObject jsonObject = ...;
+ * MutableJsonStructure mutableJsonObject = jsonObject.toMutableJsonStructure();
+ * mutableJsonObject.get(2).add("new_key","new_value").remove("unused_key");
+ * JsonString oldPhoneNumber = (JsonString) mutableJsonObject.getLeaf("phoneNumber");
+ * mutableJsonObject.set("phoneNumber", "555-4312");
+ * JsonObject mutatedJsonObject = (JsonObject) mutableJsonObject.toJsonStructure();
+ * </code>
+ * </pre>
+ *
+ * A new mutable tree can also be obtained with the static method MutableJsonStructure.createNewMutableObject() or
+ * MutableJsonStructure.createNewMutableArray()
+ *
+ * With every {@code MutableJsonStructure} an {@code Ancestor} is associated. For the top level structure the ancestor is null. Through the
+ * {@code Ancestor} the position within the parent structure (as well as the parent itself) can be obtained. Using the {@code Ancestor} its
+ * also possible to navigate bottom-up.
+ *
+ * <p>
+ * Top-down navigation is possible by using the <code>get(int)</code> (within a JSON array) or <code>get(String)</code> (within a JSON
+ * object) method.
+ * <ul>
+ * <li>In a JSON array the array size can be determined by using <code>size()</code>.</li>
+ * <li>In a JSON object the key names can be determined by using <code>getKeys()</code>.</li>
+ * </ul>
+ *
+ * Bottom-up navigation is possible by using <code>getParent()</code>
+ *
+ * <p>
+ * <b>Warning: This mutable representation will consume at least the same amount of memory then the immutable structure.</b>
+ */
+@Experimental
+public interface MutableJsonStructure {
+
+ /**
+ * Represent the ancestor of a {@code MutableJsonStructure}. Contains also
+ * the information to which key (if ancestor is an JSON object) or index (if
+ * ancestor is an JSON array) the mutable structure is attached.
+ */
+ public interface Ancestor {
+
+ /**
+ * The ancestor index (only valid if this ancestor is an JSON array)
+ *
+ * @return The zero-based ancestor index or -1 if this ancestor is a
+ * JSON object
+ */
+ int getIndex();
+
+ /**
+ * The ancestor key name (only valid if this ancestor is an JSON object)
+ *
+ * @return The ancestor key name or {@code null} if this ancestor is a
+ * JSON array
+ */
+ String getKey();
+
+ /**
+ * The ancestor structure (parent)
+ *
+ * @return the ancestor mutable structure
+ */
+ MutableJsonStructure getMutableJsonStructure();
+
+ /**
+ * Is this ancestor a JSON array (or an JSON object)?
+ *
+ * @return true if the ancestor is a JSON array, false if JSON object
+ */
+ boolean isJsonArray();
+ }
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(int index, JsonValue value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(int index, MutableJsonStructure value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(int index, Number value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(int index, String value);
+
+ /**
+ * Append the given value to this JSON array
+ *
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(JsonValue value);
+
+ /**
+ * Append the given value to this JSON array
+ *
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(MutableJsonStructure value);
+
+ /**
+ * Append the given value to this JSON array
+ *
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(Number value);
+
+ /**
+ * Append the given value to this JSON array
+ *
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(String value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(String key, JsonValue value);
+
+ /**
+ * Add (insert) the value of the given key
+ *
+ * @param key
+ * given key
+ * @param value
+ * new value which should be added
+ * @return this {@code MutableJsonStructure}
+ * @throws JsonException
+ * if current structure is not an JSON object
+ * @throws NullPointerException
+ * if key or value is null
+ */
+ MutableJsonStructure add(String key, MutableJsonStructure value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(String key, Number value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure add(String key, String value);
+
+ /**
+ * Returns a deep copy of this structure. Modifying the content of the
+ * returned structure does not affect each other at all.
+ *
+ * @return the copy
+ */
+ MutableJsonStructure copy();
+
+ /**
+ * Compares the specified object with this {@code MutableJsonStructure} for
+ * equality. Returns {@code true} if and only if the specified object is
+ * also a {@code JMutableJsonStructure}, and they represents the same
+ * structure or JSON value (leaf)
+ *
+ * @param obj
+ * the object to be compared for equality with this {@code MutableJsonStructure}
+ * @return {@code true} if the specified object is equal to this {@code JMutableJsonStructure}
+ */
+ @Override
+ boolean equals(Object obj);
+
+ /**
+ * Check if the given index exists.
+ *
+ * @param index
+ * given index
+ * @return true if index < size(), false otherwise
+ * @throws JsonException
+ * if current structure is not an JSON array
+ */
+ boolean exists(int index);
+
+ /**
+ * Check if given key exists.
+ *
+ * @param key
+ * given key
+ * @return true if getKeys().contains(key), false otherwise
+ * @throws JsonException
+ * if current structure is not an JSON object
+ */
+ boolean exists(String key);
+
+ /**
+ * Get the {@code MutableJsonStructure} denoted by the index
+ *
+ * @param index
+ * the index
+ * @return the {@code MutableJsonStructure} denoted by the index
+ * @throws JsonException
+ * if this {@code MutableJsonStructure} is not an JSON array or
+ * index is out of range
+ */
+ MutableJsonStructure get(int index);
+
+ /**
+ * Get the {@code MutableJsonStructure} denoted by the key name
+ *
+ * @param key
+ * the key name
+ * @return the {@code MutableJsonStructure} denoted by the key name
+ * @throws JsonException
+ * if this {@code MutableJsonStructure} is not an JSON object or
+ * key does not exist
+ * @throws NullPointerException
+ * if key is null
+ */
+ MutableJsonStructure get(String key);
+
+ /**
+ * Get the ancestor of this {@code MutableJsonStructure}
+ *
+ * @return the ancestor or {@code null} if this is the top level structure
+ */
+ Ancestor getAncestor();
+
+ /**
+ * Get the key names for the current JSON object
+ *
+ * @return the key names for the current JSON object as an immutable {@link Set}
+ * @throws JsonException
+ * if this {@code MutableJsonStructure} is not an JSON object
+ */
+ Set<String> getKeys();
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ JsonValue getLeaf(int index);
+
+ /**
+ * Get the {@code JsonValue} denoted by the key name
+ *
+ * @param key
+ * the key name
+ * @return the {@code JsonValue} denoted by the key name
+ * @throws JsonException
+ * if the key does not point to JsonValue (leaf) or key does not
+ * exist
+ * @throws NullPointerException
+ * if key is null
+ */
+ JsonValue getLeaf(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ boolean getLeafAsBoolean(int index);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @return TBD
+ */
+ boolean getLeafAsBoolean(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ int getLeafAsInt(int index);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @return TBD
+ */
+ int getLeafAsInt(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ String getLeafAsString(int index);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @return TBD
+ */
+ String getLeafAsString(String key);
+
+ /**
+ * Shortcut for <code>getAncestor().getMutableJsonStructure()</code>
+ *
+ * @return the parent structure or {@code null} if this is the top level
+ * structure
+ */
+ MutableJsonStructure getParent();
+
+ /**
+ * Returns the hash code value for this {@code MutableJsonStructure} object.
+ * The hash code of a {@code MutableJsonStructure} object is defined to be
+ * the hashcode of the underlying JSON object or JSON array or JsonValue
+ * (leaf).
+ *
+ * @return the hash code value for this {@code MutableJsonStructure} object
+ */
+ @Override
+ int hashCode();
+
+ /**
+ * Is this {@code MutableJsonStructure} a JSON array (or an JSON object)
+ *
+ * @return true if its a JSON array, false if JSON object
+ */
+ boolean isJsonArray();
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ boolean isLeaf(int index);
+
+ /**
+ * Check if the given key's value is a leaf (or a mutable structure)
+ *
+ * @param key
+ * given key
+ * @return true if the given key key's value is a {@code JsonValue}
+ */
+ boolean isLeaf(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ boolean isLeafNull(int index);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @return TBD
+ */
+ boolean isLeafNull(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure remove(int index);
+
+ /**
+ * Remove (delete) the value of the given key
+ *
+ * @param key
+ * given key
+ * @return this {@code MutableJsonStructure}
+ * @throws JsonException
+ * if the key does not exist or the current structure is not an
+ * JSON object
+ * @throws NullPointerException
+ * if key is null
+ */
+ MutableJsonStructure remove(String key);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(int index, JsonValue value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(int index, MutableJsonStructure value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(int index, Number value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param index
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(int index, String value);
+
+ /**
+ * This replaces the current {@code MutableJsonStructure} value with the
+ * given one. This does NOT change object references.
+ *
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(MutableJsonStructure value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(String key, JsonValue value);
+
+ /**
+ * Set (replace) the value of the given key with the given value
+ *
+ * @param key
+ * given key
+ * @param value
+ * replacement value
+ * @return this {@code MutableJsonStructure}
+ * @throws JsonException
+ * if the key does not exist or the current structure is not an
+ * JSON object
+ * @throws NullPointerException
+ * if key or value is null
+ */
+ MutableJsonStructure set(String key, MutableJsonStructure value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(String key, Number value);
+
+ /**
+ * analogous, TBD
+ *
+ * @param key
+ * TBD
+ * @param value
+ * TBD
+ * @return TBD
+ */
+ MutableJsonStructure set(String key, String value);
+
+ /**
+ * Determine the size of this mutable structure (number of keys for a JSON
+ * object, number of array members for a JSON array)
+ *
+ * @return the size of the JSON object or JSON array
+ * @throws JsonException
+ * TBD
+ */
+ int size();
+
+ /**
+ * Convert this {@code MutableJsonStructure} in a immutable {@code JsonStructure} All modifications on this {@code MutableJsonStructure}
+ * which are done after calling this method are
+ * not reflected to the returned value
+ *
+ * @return the immutable {@code JsonStructure}
+ */
+ JsonStructure toJsonStructure();
+
+ /**
+ * Returns JSON text for this mutable JSON value.
+ *
+ * @return JSON text
+ */
+ @Override
+ String toString();
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructureFactory.java
----------------------------------------------------------------------
diff --git a/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructureFactory.java b/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructureFactory.java
new file mode 100644
index 0000000..5587625
--- /dev/null
+++ b/johnzon-mutable/src/main/java/org/apache/johnzon/mutable/MutableJsonStructureFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.johnzon.mutable;
+
+import javax.json.JsonStructure;
+
+import org.apache.johnzon.core.CoreHelper;
+import org.apache.johnzon.core.Experimental;
+
+@Experimental
+public final class MutableJsonStructureFactory extends CoreHelper {
+
+ private MutableJsonStructureFactory() {
+
+ }
+
+
+ /**
+ * Create new empty mutable JSON object
+ *
+ * @return new empty mutable JSON object
+ */
+ public static MutableJsonStructure createNewMutableObject() {
+ return createNewMutableObject0();
+ }
+
+ /**
+ * Create new empty mutable JSON array
+ *
+ * @return new empty mutable JSON array
+ */
+ public static MutableJsonStructure createNewMutableArray() {
+ return createNewMutableArray0();
+ }
+
+ public static MutableJsonStructure toMutableJsonStructure(final JsonStructure structure) {
+ return toMutableJsonStructure0(structure);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/johnzon-websocket/pom.xml
----------------------------------------------------------------------
diff --git a/johnzon-websocket/pom.xml b/johnzon-websocket/pom.xml
index ad681d3..dc76817 100644
--- a/johnzon-websocket/pom.xml
+++ b/johnzon-websocket/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>johnzon</artifactId>
<groupId>org.apache.johnzon</groupId>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/01b412b8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ab973c4..8f2d033 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,14 +33,14 @@
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon</artifactId>
<packaging>pom</packaging>
- <version>0.9-incubating-SNAPSHOT</version>
+ <version>0.9-incubating-jsr374_367-SNAPSHOT</version>
<name>Apache Johnzon</name>
- <description>Apache Johnzon is an implementation of JSR-353 (JavaTM API for JSON Processing).</description>
+ <description>Apache Johnzon is an implementation of JSR-353/374/367</description>
<inceptionYear>2014</inceptionYear>
<url>http://incubator.apache.org/projects/johnzon.html</url>
<properties>
- <jsonspecversion>1.0-alpha-1</jsonspecversion>
+ <jsonspecversion>1.0-SNAPSHOT</jsonspecversion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<johnzon.site.url>https://svn.apache.org/repos/asf/incubator/johnzon/site/publish/</johnzon.site.url>
<pubsub.url>scm:svn:${johnzon.site.url}</pubsub.url>
@@ -54,12 +54,14 @@
<module>johnzon-mapper</module>
<module>johnzon-jaxrs</module>
<module>johnzon-distribution</module>
+ <module>johnzon-mutable</module>
+ <module>johnzon-websocket</module>
</modules>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
+ <artifactId>geronimo-json_1.1_spec</artifactId>
<version>${jsonspecversion}</version>
<scope>provided</scope>
</dependency>
@@ -78,8 +80,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.8</source>
+ <target>1.8</target>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
@@ -350,7 +352,7 @@
<version>[3.1,)</version>
</requireMavenVersion>
<requireJavaVersion>
- <version>[1.6,)</version>
+ <version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>