X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fmapping%2Fattributes%2Ffromxml%2FObjectXmlReader.java;h=c99d21d6ac6c011bc49f8aebd27f81f26efcb94a;hb=f43b01b81319959b1907e3e04537f5169e7f33d8;hp=2fe373475fa601dfe93df688a6910e2d48b83624;hpb=e331fa568ee0b7a33ec451a104123bcbf7d86e78;p=controller.git diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java index 2fe373475f..c99d21d6ac 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/ObjectXmlReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,9 +8,9 @@ package org.opendaylight.controller.config.facade.xml.mapping.attributes.fromxml; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; -import java.util.Date; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -25,13 +25,16 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribu import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListAttribute; import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute; import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute; +import org.opendaylight.yangtools.yang.common.Revision; public class ObjectXmlReader extends AttributeIfcSwitchStatement { private String key; - private Map> identityMap; + private Map, IdentityMapping>> identityMap; - public Map prepareReading(final Map yangToAttrConfig, final Map> identityMap) { + @SuppressWarnings("checkstyle:hiddenField") + public Map prepareReading(final Map yangToAttrConfig, + final Map, IdentityMapping>> identityMap) { Map strategies = Maps.newHashMap(); this.identityMap = identityMap; @@ -42,8 +45,8 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { - SimpleAttributeReadingStrategy innerStrategy = new SimpleAttributeReadingStrategy(getLastAttribute().getNullableDefault()); + SimpleAttributeReadingStrategy innerStrategy = new SimpleAttributeReadingStrategy( + getLastAttribute().getNullableDefault()); return new ArrayAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategy); } @Override public AttributeReadingStrategy caseJavaCompositeAttribute(final CompositeType openType) { - Preconditions.checkState(openType.keySet().size() == 1, "Unexpected number of elements for open type %s, should be 1", openType); + Preconditions.checkState(openType.keySet().size() == 1, + "Unexpected number of elements for open type %s, should be 1", openType); String mappingKey = openType.keySet().iterator().next(); return new SimpleCompositeAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey); } @@ -80,9 +85,11 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { Preconditions.checkState(openType instanceof CompositeType); Set keys = ((CompositeType) openType).keySet(); - Preconditions.checkState(keys.size() == 1, "Unexpected number of elements for open type %s, should be 1", openType); + Preconditions.checkState(keys.size() == 1, "Unexpected number of elements for open type %s, should be 1", + openType); String mappingKey = keys.iterator().next(); - return new SimpleIdentityRefAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey, identityMap); + return new SimpleIdentityRefAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey, + identityMap); } @Override @@ -94,7 +101,7 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement inner = ((TOAttribute)lastAttribute).getYangPropertiesToTypesMap(); + Map inner = ((TOAttribute) lastAttribute).getYangPropertiesToTypesMap(); Map innerStrategies = Maps.newHashMap(); @@ -103,7 +110,6 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement openType) { AttributeIfc lastAttribute = getLastAttribute(); Preconditions.checkState(lastAttribute instanceof ListAttribute); - AttributeReadingStrategy innerStrategy = prepareReadingStrategy(key, ((ListAttribute) lastAttribute).getInnerAttribute()); + AttributeReadingStrategy innerStrategy = prepareReadingStrategy(key, + ((ListAttribute) lastAttribute).getInnerAttribute()); return new ArrayAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategy); } @@ -122,5 +129,4 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement