generator.writeEndObject();
}
protected MediaContent readMediaContent(JsonParser parser) throws IOException
{
MediaContent mc = new MediaContent();
if (parser.nextToken() != JsonToken.START_OBJECT) {
reportIllegal(parser, JsonToken.START_OBJECT);
}
// loop for main-level fields
JsonToken t;
while ((t = parser.nextToken()) != JsonToken.END_OBJECT) {
if (t != JsonToken.FIELD_NAME) {
reportIllegal(parser, JsonToken.FIELD_NAME);
}
String field = parser.getCurrentName();
Integer I = fieldToIndex.get(field);
if (I != null) {
switch (I.intValue()) {
case FIELD_IX_MEDIA:
mc.setMedia(readMedia(parser));
continue;
case FIELD_IX_IMAGES:
if (parser.nextToken() != JsonToken.START_ARRAY) {
reportIllegal(parser, JsonToken.START_ARRAY);
}
while (parser.nextToken() == JsonToken.START_OBJECT) {
mc.addImage(readImage(parser));
}
continue;
}
}
throw new IllegalStateException("Unexpected field '"+field+"'");