public DomainInfo unmarshall(JsonUnmarshallerContext context) throws Exception { DomainInfo domainInfo = new DomainInfo(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) return null; while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("DomainName", targetDepth)) { context.nextToken(); domainInfo.setDomainName(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 domainInfo; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(DomainInfo domainInfo, StructuredJsonGenerator jsonGenerator) { if (domainInfo == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (domainInfo.getDomainName() != null) { jsonGenerator.writeFieldName("DomainName").writeValue(domainInfo.getDomainName()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }