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%2Fmapping%2FObjectMapper.java;h=0dc03bf4026dbcbacb55cf9e516c325d1b609381;hb=refs%2Fchanges%2F40%2F62940%2F4;hp=9e2c69b9f3d9ad551ee35c81780e8be13c0d1c71;hpb=b197d75e803beac663033287d769dce62c108490;p=controller.git diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java index 9e2c69b9f3..0dc03bf402 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/mapping/ObjectMapper.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, @@ -36,25 +36,25 @@ public class ObjectMapper extends AttributeIfcSwitchStatement attrEntry : configDefinition.entrySet()) { strategies.put(attrEntry.getKey(), prepareStrategy(attrEntry.getValue())); } - return strategies; } public AttributeMappingStrategy> prepareStrategy(final AttributeIfc attributeIfc) { - if(attributeIfc instanceof DependencyAttribute) { - namespaceOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString(); + if (attributeIfc instanceof DependencyAttribute) { + namespaceOfDepAttr = ((DependencyAttribute) attributeIfc).getDependency().getSie().getQName().getNamespace() + .toString(); } else if (attributeIfc instanceof ListDependenciesAttribute) { - namespaceOfDepAttr = ((ListDependenciesAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString(); + namespaceOfDepAttr = ((ListDependenciesAttribute) attributeIfc).getDependency().getSie().getQName() + .getNamespace().toString(); } - return switchAttribute(attributeIfc); } private Map createJmxToYangMapping(final TOAttribute attributeIfc) { Map retVal = Maps.newHashMap(); for (Entry entry : attributeIfc.getJmxPropertiesToTypesMap().entrySet()) { - retVal.put(entry.getKey(), (entry.getValue()).getAttributeYangName()); + retVal.put(entry.getKey(), entry.getValue().getAttributeYangName()); } return retVal; } @@ -66,7 +66,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaEnumAttribute(final OpenType openType) { - return new EnumAttributeMappingStrategy(((CompositeType) openType), enumResolver); + return new EnumAttributeMappingStrategy((CompositeType) openType, enumResolver); } @Override @@ -78,7 +78,8 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseJavaCompositeAttribute(final CompositeType openType) { + protected AttributeMappingStrategy> caseJavaCompositeAttribute( + final CompositeType openType) { Map>> innerStrategies = Maps.newHashMap(); Map attributeMapping = Maps.newHashMap(); @@ -88,7 +89,6 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseDependencyAttribute( - final SimpleType openType) { + protected AttributeMappingStrategy> caseDependencyAttribute(final SimpleType openType) { return new ObjectNameAttributeMappingStrategy(openType, namespaceOfDepAttr); } @@ -123,12 +121,12 @@ public class ObjectMapper extends AttributeIfcSwitchStatement innerAttrEntry : ((TOAttribute)getLastAttribute()).getJmxPropertiesToTypesMap().entrySet()) { + for (Entry innerAttrEntry : ((TOAttribute) getLastAttribute()) + .getJmxPropertiesToTypesMap().entrySet()) { innerStrategies.put(innerAttrEntry.getKey(), prepareStrategy(innerAttrEntry.getValue())); } - return new CompositeAttributeMappingStrategy(openType, innerStrategies, - createJmxToYangMapping(lastTO)); + return new CompositeAttributeMappingStrategy(openType, innerStrategies, createJmxToYangMapping(lastTO)); } @Override @@ -139,9 +137,9 @@ public class ObjectMapper extends AttributeIfcSwitchStatement> caseListDependeciesAttribute(final ArrayType openType) { + protected AttributeMappingStrategy> caseListDependeciesAttribute( + final ArrayType openType) { Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute); return new ArrayAttributeMappingStrategy(openType, caseDependencyAttribute(SimpleType.OBJECTNAME)); } - }