public VolumeConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception { VolumeConfiguration volumeConfiguration = new VolumeConfiguration(); 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("MountPoint", targetDepth)) { context.nextToken(); volumeConfiguration.setMountPoint( StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("RaidLevel", targetDepth)) { context.nextToken(); volumeConfiguration.setRaidLevel( IntegerJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("NumberOfDisks", targetDepth)) { context.nextToken(); volumeConfiguration.setNumberOfDisks( IntegerJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Size", targetDepth)) { context.nextToken(); volumeConfiguration.setSize(IntegerJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("VolumeType", targetDepth)) { context.nextToken(); volumeConfiguration.setVolumeType( StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Iops", targetDepth)) { context.nextToken(); volumeConfiguration.setIops(IntegerJsonUnmarshaller.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 volumeConfiguration; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof VolumeConfiguration == false) return false; VolumeConfiguration other = (VolumeConfiguration) obj; if (other.getMountPoint() == null ^ this.getMountPoint() == null) return false; if (other.getMountPoint() != null && other.getMountPoint().equals(this.getMountPoint()) == false) return false; if (other.getRaidLevel() == null ^ this.getRaidLevel() == null) return false; if (other.getRaidLevel() != null && other.getRaidLevel().equals(this.getRaidLevel()) == false) return false; if (other.getNumberOfDisks() == null ^ this.getNumberOfDisks() == null) return false; if (other.getNumberOfDisks() != null && other.getNumberOfDisks().equals(this.getNumberOfDisks()) == false) return false; if (other.getSize() == null ^ this.getSize() == null) return false; if (other.getSize() != null && other.getSize().equals(this.getSize()) == false) return false; return true; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( VolumeConfiguration volumeConfiguration, StructuredJsonGenerator jsonGenerator) { if (volumeConfiguration == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (volumeConfiguration.getMountPoint() != null) { jsonGenerator.writeFieldName("MountPoint").writeValue(volumeConfiguration.getMountPoint()); } if (volumeConfiguration.getRaidLevel() != null) { jsonGenerator.writeFieldName("RaidLevel").writeValue(volumeConfiguration.getRaidLevel()); } if (volumeConfiguration.getNumberOfDisks() != null) { jsonGenerator .writeFieldName("NumberOfDisks") .writeValue(volumeConfiguration.getNumberOfDisks()); } if (volumeConfiguration.getSize() != null) { jsonGenerator.writeFieldName("Size").writeValue(volumeConfiguration.getSize()); } if (volumeConfiguration.getVolumeType() != null) { jsonGenerator.writeFieldName("VolumeType").writeValue(volumeConfiguration.getVolumeType()); } if (volumeConfiguration.getIops() != null) { jsonGenerator.writeFieldName("Iops").writeValue(volumeConfiguration.getIops()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }