MCPcopy Index your code
hub / github.com/cschanck/single-file-java / JObject

Interface JObject

src/main/java/org/sfj/JSONOne.java:68–108  ·  view source on GitHub ↗

A JSON object. Asking for the value as the worng type results in a ClassCastException.

Source from the content-addressed store, hash-verified

66 * ClassCastException.
67 */
68 public interface JObject extends Serializable {
69 default JArray arrayValue() {
70 throw new ClassCastException();
71 }
72
73 default boolean boolValue() {
74 throw new ClassCastException();
75 }
76
77 JSONOne.Type getType();
78
79 default JMap mapValue() {
80 throw new ClassCastException();
81 }
82
83 default boolean nullValue() {
84 return false;
85 }
86
87 default Number numberValue() {
88 throw new ClassCastException();
89 }
90
91 Object pojoValue();
92
93 default String stringValue() {
94 throw new ClassCastException();
95 }
96
97 void print(Writer w, int indent, boolean compact) throws IOException;
98
99 default String print(boolean compact) throws IOException { return print(0, compact); }
100
101 default String print() throws IOException { return print(0, true); }
102
103 default String print(int indent, boolean compact) throws IOException {
104 StringWriter sw = new StringWriter();
105 print(sw, indent, compact);
106 return sw.toString();
107 }
108 }
109
110 private static abstract class AbstractJSONObject implements JObject {
111 private Type type;

Callers 36

testSimpleJsonMethod · 0.65
testParseBooleanMethod · 0.65
testSimpleJsonMethod · 0.65
getTypedMethod · 0.95
isNullMethod · 0.95
testParseBooleanMethod · 0.65
testParseNumberMethod · 0.65
testParseStringMethod · 0.65
testParseNullMethod · 0.65
testSimpleArraysMethod · 0.65
testParseColorsMethod · 0.65
testParseColorsMethod · 0.65

Implementers 3

AbstractJSONObjectsrc/main/java/org/sfj/JSONOne.java
JArraysrc/main/java/org/sfj/JSONOne.java
JMapsrc/main/java/org/sfj/JSONOne.java

Calls

no outgoing calls

Tested by

no test coverage detected