public static Customer deserialize(final String input) throws IOException { final Reader reader = new StringReader(input); int nextToken = ManualJson.getNextToken(reader); if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); return deserialize(reader, new char[38], new int[1], nextToken, null); }
public static Customer deserialize( final Reader reader, final char[] buffer, final int[] tokens, int nextToken, final ServiceLocator locator) throws IOException { String _uri = ""; long _id = 0L; String _name = ""; Profile _profile = new Profile(); ArrayList<Account> _accounts = null; if (nextToken == '}') return new Customer(_uri, _id, _name, _profile, _accounts, locator); int nameHash = ManualJson.fillName(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); if (nextToken == 'n') { if (reader.read() != 'u' || reader.read() != 'l' || reader.read() != 'l') throw new IOException("null value expected"); } else { switch (nameHash) { case 1: _uri = StringConverter.deserialize(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); break; case 25458: _id = NumberConverter.deserializeInt(reader, buffer, tokens, nextToken); nextToken = ManualJson.moveToNextToken(reader, tokens[0]); break; case 24614690: _name = StringConverter.deserialize(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); break; case 1120506290: if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); _profile = ProfileManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken); nextToken = ManualJson.getNextToken(reader); break; case -758926083: if (nextToken != '[') throw new IOException("Expecting '['"); nextToken = ManualJson.getNextToken(reader); if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); _accounts = new ArrayList<Account>(); _accounts.add( AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken)); while ((nextToken = ManualJson.getNextToken(reader)) == ',') { nextToken = ManualJson.getNextToken(reader); if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); _accounts.add( AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken)); } nextToken = ManualJson.getNextToken(reader); break; default: nextToken = ManualJson.skip(reader, buffer, tokens, nextToken); break; } } while (nextToken == ',') { nextToken = ManualJson.getNextToken(reader); nameHash = ManualJson.fillName(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); if (nextToken == 'n') { if (reader.read() == 'u' && reader.read() == 'l' && reader.read() == 'l') { nextToken = ManualJson.getNextToken(reader); continue; } throw new IOException("null value expected"); } else { switch (nameHash) { case 1: _uri = StringConverter.deserialize(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); break; case 25458: _id = NumberConverter.deserializeInt(reader, buffer, tokens, nextToken); nextToken = ManualJson.moveToNextToken(reader, tokens[0]); break; case 24614690: _name = StringConverter.deserialize(reader, buffer, nextToken); nextToken = ManualJson.getNextToken(reader); break; case 1120506290: _profile = ProfileManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken); nextToken = ManualJson.getNextToken(reader); break; case -758926083: if (nextToken != '[') throw new IOException("Expecting '['"); nextToken = ManualJson.getNextToken(reader); if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); _accounts = new ArrayList<Account>(); _accounts.add( AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken)); while ((nextToken = ManualJson.getNextToken(reader)) == ',') { nextToken = ManualJson.getNextToken(reader); if (nextToken != '{') throw new IOException("Expecting '{'"); nextToken = ManualJson.getNextToken(reader); _accounts.add( AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken)); } nextToken = ManualJson.getNextToken(reader); break; default: nextToken = ManualJson.skip(reader, buffer, tokens, nextToken); break; } } } if (nextToken != '}') { if (nextToken == -1) throw new IOException("Unexpected end of json in object Transaction"); else throw new IOException( "Expecting '}' at position " + ManualJson.positionInStream(reader) + ". Found " + (char) nextToken); } return new Customer(_uri, _id, _name, _profile, _accounts, locator); }