@Test public final void testDecodeBoolean() { JSONDecoder decoder = new JSONDecoder("[null,true,12]"); JSONValue result = decoder.decode(); TestCase.assertEquals("[null,true,12]", result.toJSON()); }
public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Character.isDigit(current) || current == Opener.MINUS.sign || current == Opener.PLUS.sign || current == Opener.DOT.sign) { return decodeNumber(); } else if( current == Opener.NULL.sign || current == Opener.NULL_UPPER.sign) { return decodeNull(); } else if( current == Opener.FALSE.sign || current == Opener.FALSE_UPPER.sign) { return decodeFalse(); } else if( current == Opener.TRUE.sign || current == Opener.TRUE_UPPER.sign) { return decodeTrue(); } return null; }
JSONDecoder { public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Character.isDigit(current) || current == Opener.MINUS.sign || current == Opener.PLUS.sign || current == Opener.DOT.sign) { return decodeNumber(); } else if( current == Opener.NULL.sign || current == Opener.NULL_UPPER.sign) { return decodeNull(); } else if( current == Opener.FALSE.sign || current == Opener.FALSE_UPPER.sign) { return decodeFalse(); } else if( current == Opener.TRUE.sign || current == Opener.TRUE_UPPER.sign) { return decodeTrue(); } return null; } }
JSONDecoder { public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Character.isDigit(current) || current == Opener.MINUS.sign || current == Opener.PLUS.sign || current == Opener.DOT.sign) { return decodeNumber(); } else if( current == Opener.NULL.sign || current == Opener.NULL_UPPER.sign) { return decodeNull(); } else if( current == Opener.FALSE.sign || current == Opener.FALSE_UPPER.sign) { return decodeFalse(); } else if( current == Opener.TRUE.sign || current == Opener.TRUE_UPPER.sign) { return decodeTrue(); } return null; } JSONDecoder(final String json); }
JSONDecoder { public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Character.isDigit(current) || current == Opener.MINUS.sign || current == Opener.PLUS.sign || current == Opener.DOT.sign) { return decodeNumber(); } else if( current == Opener.NULL.sign || current == Opener.NULL_UPPER.sign) { return decodeNull(); } else if( current == Opener.FALSE.sign || current == Opener.FALSE_UPPER.sign) { return decodeFalse(); } else if( current == Opener.TRUE.sign || current == Opener.TRUE_UPPER.sign) { return decodeTrue(); } return null; } JSONDecoder(final String json); JSONValue decode(); }
JSONDecoder { public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Character.isDigit(current) || current == Opener.MINUS.sign || current == Opener.PLUS.sign || current == Opener.DOT.sign) { return decodeNumber(); } else if( current == Opener.NULL.sign || current == Opener.NULL_UPPER.sign) { return decodeNull(); } else if( current == Opener.FALSE.sign || current == Opener.FALSE_UPPER.sign) { return decodeFalse(); } else if( current == Opener.TRUE.sign || current == Opener.TRUE_UPPER.sign) { return decodeTrue(); } return null; } JSONDecoder(final String json); JSONValue decode();  }