com.amazonaws.services.elasticache.model.transform.SnapshotStaxUnmarshaller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-elasticache Show documentation
Show all versions of aws-java-sdk-elasticache Show documentation
The AWS Java SDK for Amazon ElastiCache module holds the client classes that are used for communicating with Amazon ElastiCache Service
/*
* Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.elasticache.model.transform;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map.Entry;
import javax.xml.stream.events.XMLEvent;
import com.amazonaws.services.elasticache.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.MapEntry;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
/**
* Snapshot StAX Unmarshaller
*/
public class SnapshotStaxUnmarshaller implements
Unmarshaller {
public Snapshot unmarshall(StaxUnmarshallerContext context)
throws Exception {
Snapshot snapshot = new Snapshot();
int originalDepth = context.getCurrentDepth();
int targetDepth = originalDepth + 1;
if (context.isStartOfDocument())
targetDepth += 3;
while (true) {
XMLEvent xmlEvent = context.nextEvent();
if (xmlEvent.isEndDocument())
return snapshot;
if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
if (context.testExpression("SnapshotName", targetDepth)) {
snapshot.setSnapshotName(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("CacheClusterId", targetDepth)) {
snapshot.setCacheClusterId(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("SnapshotStatus", targetDepth)) {
snapshot.setSnapshotStatus(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("SnapshotSource", targetDepth)) {
snapshot.setSnapshotSource(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("CacheNodeType", targetDepth)) {
snapshot.setCacheNodeType(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("Engine", targetDepth)) {
snapshot.setEngine(StringStaxUnmarshaller.getInstance()
.unmarshall(context));
continue;
}
if (context.testExpression("EngineVersion", targetDepth)) {
snapshot.setEngineVersion(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("NumCacheNodes", targetDepth)) {
snapshot.setNumCacheNodes(IntegerStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("PreferredAvailabilityZone",
targetDepth)) {
snapshot.setPreferredAvailabilityZone(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("CacheClusterCreateTime",
targetDepth)) {
snapshot.setCacheClusterCreateTime(DateStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("PreferredMaintenanceWindow",
targetDepth)) {
snapshot.setPreferredMaintenanceWindow(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("TopicArn", targetDepth)) {
snapshot.setTopicArn(StringStaxUnmarshaller.getInstance()
.unmarshall(context));
continue;
}
if (context.testExpression("Port", targetDepth)) {
snapshot.setPort(IntegerStaxUnmarshaller.getInstance()
.unmarshall(context));
continue;
}
if (context.testExpression("CacheParameterGroupName",
targetDepth)) {
snapshot.setCacheParameterGroupName(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("CacheSubnetGroupName", targetDepth)) {
snapshot.setCacheSubnetGroupName(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("VpcId", targetDepth)) {
snapshot.setVpcId(StringStaxUnmarshaller.getInstance()
.unmarshall(context));
continue;
}
if (context.testExpression("AutoMinorVersionUpgrade",
targetDepth)) {
snapshot.setAutoMinorVersionUpgrade(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("SnapshotRetentionLimit",
targetDepth)) {
snapshot.setSnapshotRetentionLimit(IntegerStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("SnapshotWindow", targetDepth)) {
snapshot.setSnapshotWindow(StringStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("NodeSnapshots/NodeSnapshot",
targetDepth)) {
snapshot.withNodeSnapshots(NodeSnapshotStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
} else if (xmlEvent.isEndElement()) {
if (context.getCurrentDepth() < originalDepth) {
return snapshot;
}
}
}
}
private static SnapshotStaxUnmarshaller instance;
public static SnapshotStaxUnmarshaller getInstance() {
if (instance == null)
instance = new SnapshotStaxUnmarshaller();
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy