- * Licensed 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. - */ -@SuppressWarnings("WeakerAccess") -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface JSONContainer {} diff --git a/src/main/java/de/arraying/kotys/JSONForger.java b/src/main/java/de/arraying/kotys/JSONForger.java deleted file mode 100644 index c8fe4f4..0000000 --- a/src/main/java/de/arraying/kotys/JSONForger.java +++ /dev/null @@ -1,36 +0,0 @@ -package de.arraying.kotys; - -/** - * Copyright 2017 Arraying - *
- * Licensed 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.
- */
-@SuppressWarnings({"unused", "WeakerAccess"})
-public class JSONForger {
-
- /**
- * "Forges" the {@link de.arraying.kotys.JSONContainer} annotation, treating instances as if they have this annotation.
- * @param container The class of the container that should be forged.
- * @return The current JSONForger object, for chaining purposes.
- * @throws IllegalArgumentException If the container is null.
- */
- public JSONForger treatAsClassAnnotation(Class> container)
- throws IllegalArgumentException {
- if(container == null) {
- throw new IllegalArgumentException("Container is null");
- }
- JSONStorage.getInstance().register(container);
- return this;
- }
-
-}
diff --git a/src/main/java/de/arraying/kotys/JSONFormatter.java b/src/main/java/de/arraying/kotys/JSONFormatter.java
index 0fccaed..c9d7056 100644
--- a/src/main/java/de/arraying/kotys/JSONFormatter.java
+++ b/src/main/java/de/arraying/kotys/JSONFormatter.java
@@ -19,7 +19,6 @@
final class JSONFormatter {
private final StringBuilder builder = new StringBuilder();
- private final JSONUtil util = new JSONUtil();
/**
* Starts a new JSON object.
@@ -67,12 +66,22 @@ JSONFormatter comma() {
}
/**
- * Appends an array entry.
- * @param value The value.
+ * Appends an object.
+ * @param object The object.
* @return The formatter for chaining purposes.
*/
- JSONFormatter array(Object value) {
- builder.append(value);
+ JSONFormatter object(String object) {
+ builder.append(object);
+ return this;
+ }
+
+ /**
+ * Appends an array.
+ * @param array The array.
+ * @return The formatter for chaining purposes.
+ */
+ JSONFormatter array(String array) {
+ builder.append(array);
return this;
}
@@ -90,11 +99,11 @@ JSONFormatter objectKey(String key) {
}
/**
- * Appends the object value.
+ * Appends the value.
* @param value The value of the object.
* @return The formatter for chaining purposes.
*/
- JSONFormatter objectValue(Object value) {
+ JSONFormatter value(Object value) {
if(value instanceof String) {
builder.append("\"")
.append(value)
diff --git a/src/main/java/de/arraying/kotys/JSONORM.java b/src/main/java/de/arraying/kotys/JSONORM.java
index aa468a0..b36017b 100644
--- a/src/main/java/de/arraying/kotys/JSONORM.java
+++ b/src/main/java/de/arraying/kotys/JSONORM.java
@@ -172,18 +172,13 @@ T mapTo(JSON json, String... ignoredJSONKeys) {
* @return An immutable list of field containers.
*/
private List
- * Licensed 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.
- */
-class JSONStorage {
-
- private static JSONStorage instance;
- private static final Object mutex = new Object();
- private final Set