-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ralph Niemitz <[email protected]>
- Loading branch information
Showing
17 changed files
with
888 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]) | ||
|
@@ -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)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.. | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]) | ||
|
@@ -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)); | ||
} | ||
|
@@ -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)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
||
|
@@ -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; | ||
|
@@ -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. | ||
*/ | ||
|
@@ -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 | ||
|
Oops, something went wrong.