public DataRetrievalRule unmarshall(JsonUnmarshallerContext context) throws Exception { DataRetrievalRule dataRetrievalRule = new DataRetrievalRule(); 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("Strategy", targetDepth)) { context.nextToken(); dataRetrievalRule.setStrategy(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("BytesPerHour", targetDepth)) { context.nextToken(); dataRetrievalRule.setBytesPerHour(LongJsonUnmarshaller.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 dataRetrievalRule; }
/** * The type of data retrieval policy to set. * * <p>Valid values: BytesPerHour|FreeTier|None * * @param strategy The type of data retrieval policy to set. * <p>Valid values: BytesPerHour|FreeTier|None * @return Returns a reference to this object so that method calls can be chained together. */ public DataRetrievalRule withStrategy(String strategy) { setStrategy(strategy); return this; }