Skip to content

Commit

Permalink
2017-07-30
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph Niemitz <[email protected]>
  • Loading branch information
RalleYTN committed Jul 30, 2017
1 parent cc37feb commit 34b1b2b
Show file tree
Hide file tree
Showing 17 changed files with 888 additions and 625 deletions.
10 changes: 4 additions & 6 deletions src/de/ralleytn/simple/json/JSONArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@
import java.util.Date;
import java.util.Iterator;

import de.ralleytn.simple.json.parser.JSONParser;

/**
* Represents a JSON array.
* @author FangYidong([email protected])
Expand Down Expand Up @@ -381,22 +379,22 @@ public JSONArray(Object array) {
/**
* Constructs a {@linkplain JSONArray} from JSON data.
* @param json the JSON data
* @throws de.ralleytn.simple.json.parser.ParseException if the JSON data is invalid
* @throws JSONParseException if the JSON data is invalid
* @since 1.0.0
*/
public JSONArray(String json) throws de.ralleytn.simple.json.parser.ParseException {
public JSONArray(String json) throws JSONParseException {

super((JSONArray)new JSONParser().parse(json));
}

/**
* Constructs a {@linkplain JSONArray} from JSON data read from a {@linkplain Reader}.
* @param jsonReader the {@linkplain Reader} with the JSON data
* @throws de.ralleytn.simple.json.parser.ParseException if the JSON data is invalid
* @throws JSONParseException if the JSON data is invalid
* @throws IOException if an I/O error occurred
* @since 1.0.0
*/
public JSONArray(Reader jsonReader) throws de.ralleytn.simple.json.parser.ParseException, IOException {
public JSONArray(Reader jsonReader) throws JSONParseException, IOException {

super((JSONArray)new JSONParser().parse(jsonReader));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.ralleytn.simple.json.parser;
package de.ralleytn.simple.json;

import java.util.List;
import java.util.Map;

import de.ralleytn.simple.json.JSONArray;
import de.ralleytn.simple.json.JSONObject;

/**
* Container factory which creates containers for {@linkplain JSONObject} and {@linkplain JSONArray}.
* @see de.ralleytn.simple.json.parser.JSONParser#parse(java.io.Reader, ContainerFactory)
* @see de.ralleytn.simple.json.JSONParser#parse(java.io.Reader, ContainerFactory)
* @author FangYidong([email protected])
* @author Ralph Niemitz/RalleYTN([email protected])
* @version 1.0.0
* @since 1.0.0
*/
public interface ContainerFactory {
public interface JSONContainerFactory {

/**
* @return A {@linkplain Map} instance to store the data for a JSON object, or {@code null} if you want to use {@linkplain JSONObject} instead..
Expand Down
309 changes: 309 additions & 0 deletions src/de/ralleytn/simple/json/JSONContentHandler.java

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions src/de/ralleytn/simple/json/JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@
import java.util.LinkedHashMap;
import java.util.Map;

import de.ralleytn.simple.json.parser.JSONParser;

/**
* Represents a JSON object.
* @author FangYidong([email protected])
Expand Down Expand Up @@ -247,10 +245,10 @@ public JSONObject(Map<?, ?> map) {
/**
* Constructs a {@linkplain JSONObject} from JSON data.
* @param json the JSON data
* @throws de.ralleytn.simple.json.parser.ParseException if the JSON data is invalid
* @throws JSONParseException if the JSON data is invalid
* @since 1.0.0
*/
public JSONObject(String json) throws de.ralleytn.simple.json.parser.ParseException {
public JSONObject(String json) throws JSONParseException {

super((JSONObject)new JSONParser().parse(json));
}
Expand All @@ -259,10 +257,10 @@ public JSONObject(String json) throws de.ralleytn.simple.json.parser.ParseExcept
* Constructs a {@linkplain JSONObject} from JSON data read from a {@linkplain Reader}.
* @param jsonReader the {@linkplain Reader} with the JSON data
* @throws IOException if an I/O error occurred
* @throws de.ralleytn.simple.json.parser.ParseException if the JSON data is invalid
* @throws JSONParseException if the JSON data is invalid
* @since 1.0.0
*/
public JSONObject(Reader jsonReader) throws IOException, de.ralleytn.simple.json.parser.ParseException {
public JSONObject(Reader jsonReader) throws IOException, JSONParseException {

super((JSONObject)new JSONParser().parse(jsonReader));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.ralleytn.simple.json.parser;
package de.ralleytn.simple.json;

/**
* ParseException explains why and where the error occurs in source JSON text.
*
* @author FangYidong([email protected])
* @author Ralph Niemitz/RalleYTN([email protected])
*/
public class ParseException extends Exception {
public class JSONParseException extends Exception {

private static final long serialVersionUID = -7880698968187728547L;

Expand All @@ -221,17 +221,17 @@ public class ParseException extends Exception {
private Object unexpectedObject;
private int position;

public ParseException(int errorType) {
public JSONParseException(int errorType) {

this(-1, errorType, null);
}

public ParseException(int errorType, Object unexpectedObject) {
public JSONParseException(int errorType, Object unexpectedObject) {

this(-1, errorType, unexpectedObject);
}

public ParseException(int position, int errorType, Object unexpectedObject) {
public JSONParseException(int position, int errorType, Object unexpectedObject) {

this.position = position;
this.errorType = errorType;
Expand All @@ -249,7 +249,7 @@ public void setErrorType(int errorType) {
}

/**
* @see de.ralleytn.simple.json.parser.JSONParser#getPosition()
* @see de.ralleytn.simple.json.JSONParser#getPosition()
*
* @return The character position (starting with 0) of the input where the error occurs.
*/
Expand All @@ -264,7 +264,7 @@ public void setPosition(int position) {
}

/**
* @see de.ralleytn.simple.json.parser.Yytoken
* @see de.ralleytn.simple.json.Yytoken
*
* @return One of the following base on the value of errorType:
* ERROR_UNEXPECTED_CHAR java.lang.Character
Expand Down
Loading

0 comments on commit 34b1b2b

Please sign in to comment.