List of usage examples for com.amazonaws.transform ListUnmarshaller ListUnmarshaller
public ListUnmarshaller(Unmarshaller<T, JsonUnmarshallerContext> itemUnmarshaller)
From source file:com.ivona.services.tts.model.transform.lexicons.ListLexiconsResultJsonUnmarshaller.java
License:Open Source License
public ListLexiconsResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListLexiconsResult listLexiconsResult = new ListLexiconsResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) { token = context.nextToken();/*from ww w. ja v a 2 s.c om*/ } if (token == VALUE_NULL) { return null; } while (true) { if (token == null) { break; } if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression(JSON_KEY_LEXICONS, targetDepth)) { listLexiconsResult.setLexiconNames(new ListUnmarshaller<String>( SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) { break; } } } token = context.nextToken(); } return listLexiconsResult; }
From source file:com.ivona.services.tts.model.transform.listvoices.ListVoicesResultJsonUnmarshaller.java
License:Open Source License
public ListVoicesResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListVoicesResult listVoicesResult = new ListVoicesResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) { token = context.nextToken();/*from w ww .ja v a 2 s . c o m*/ } if (token == VALUE_NULL) { return null; } while (true) { if (token == null) { break; } if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression(JSON_KEY_VOICES, targetDepth)) { listVoicesResult.setVoices( new ListUnmarshaller<Voice>(VoiceJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) { break; } } } token = context.nextToken(); } return listVoicesResult; }