}
private Department parseDepartment() throws Exception {
accept(JsonToken.START_OBJECT);
Department company = new Department();
for (;;) {
JsonToken tok = parser.getCurrentToken();
if (tok == JsonToken.END_OBJECT) {
break;
}
if (tok == JsonToken.FIELD_NAME) {
String name = parser.getCurrentName();
tok = parser.nextToken();
if ("name" == name) {
company.setName(acceptString(tok));
} else if ("description" == name) {
company.setDescription(acceptString(tok));
} else if ("id" == name) {
company.setId(acceptLong(tok));
} else if ("children" == name) {
parseDepartment(company.getChildren());
} else if ("members" == name) {
parseEmployee(company.getMembers());
} else {
throw new RuntimeException("not match property : " + name);
}
}
}