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; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DataRetrievalRule == false) return false; DataRetrievalRule other = (DataRetrievalRule) obj; if (other.getStrategy() == null ^ this.getStrategy() == null) return false; if (other.getStrategy() != null && other.getStrategy().equals(this.getStrategy()) == false) return false; if (other.getBytesPerHour() == null ^ this.getBytesPerHour() == null) return false; if (other.getBytesPerHour() != null && other.getBytesPerHour().equals(this.getBytesPerHour()) == false) return false; return true; }