Fix raw type warnings
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / xml / codec / XmlUtils.java
index 85d2c31ad3bff437ffcd77d922ab0269c652857a..7b12a6851e9868232be6151a390298379845de42 100644 (file)
@@ -24,63 +24,63 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
  */
 public class XmlUtils {
 
-  public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
-    @Override
-    public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
-      return TypeDefinitionAwareCodec.from(baseType);
-    }
-  };
+    public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
+        @Override
+        public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
+            return TypeDefinitionAwareCodec.from(baseType);
+        }
+    };
 
-  private XmlUtils() {
-  }
+    private XmlUtils() {
+    }
 
-  public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
-    TypeDefinition<?> superType = type;
-    while (superType.getBaseType() != null) {
-      superType = superType.getBaseType();
+    public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
+        TypeDefinition<?> superType = type;
+        while (superType.getBaseType() != null) {
+            superType = superType.getBaseType();
+        }
+        return superType;
     }
-    return superType;
-  }
 
-  /**
-   * This code is picked from yangtools and modified to add type of instance identifier
-   * output of instance identifier something like below for a flow ref composite node of type instance identifier,
-   * which has path arguments with predicates, whose value is of type java.lang.short
-   * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
-   *   /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
-   *   /bgkj:table[bgkj:id='3@java.lang.Short']
-   *   /bgkj:flow[bgkj:id='156@java.lang.String']
-   * </flow-ref>
-   *
-   */
+    /**
+     * This code is picked from yangtools and modified to add type of instance identifier
+     * output of instance identifier something like below for a flow ref composite node of type instance identifier,
+     * which has path arguments with predicates, whose value is of type java.lang.short
+     * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
+     *   /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
+     *   /bgkj:table[bgkj:id='3@java.lang.Short']
+     *   /bgkj:flow[bgkj:id='156@java.lang.String']
+     * </flow-ref>
+     *
+     */
 
-  public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
-    final StringBuilder textContent = new StringBuilder();
-    for (final PathArgument pathArgument : id.getPathArguments()) {
-      textContent.append('/');
-      textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
-      if (pathArgument instanceof NodeIdentifierWithPredicates) {
-        final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
+    public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
+        final StringBuilder textContent = new StringBuilder();
+        for (final PathArgument pathArgument : id.getPathArguments()) {
+            textContent.append('/');
+            textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
+            if (pathArgument instanceof NodeIdentifierWithPredicates) {
+                final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
 
-        for (final QName keyValue : predicates.keySet()) {
-          final Object value = predicates.get(keyValue);
-          final String type = value.getClass().getName();
-          final String predicateValue = String.valueOf(value);
-          textContent.append('[');
-          textContent.append(prefixes.encodeQName(keyValue));
-          textContent.append("='");
-          textContent.append(predicateValue);
-          textContent.append("@");
-          textContent.append(type);
-          textContent.append("']");
+                for (final QName keyValue : predicates.keySet()) {
+                    final Object value = predicates.get(keyValue);
+                    final String type = value.getClass().getName();
+                    final String predicateValue = String.valueOf(value);
+                    textContent.append('[');
+                    textContent.append(prefixes.encodeQName(keyValue));
+                    textContent.append("='");
+                    textContent.append(predicateValue);
+                    textContent.append("@");
+                    textContent.append(type);
+                    textContent.append("']");
+                }
+            } else if (pathArgument instanceof NodeWithValue) {
+                textContent.append("[.='");
+                textContent.append(((NodeWithValue<?>) pathArgument).getValue());
+                textContent.append("']");
+            }
         }
-      } else if (pathArgument instanceof NodeWithValue) {
-        textContent.append("[.='");
-        textContent.append(((NodeWithValue) pathArgument).getValue());
-        textContent.append("']");
-      }
-    }
 
-    return textContent.toString();
-  }
+        return textContent.toString();
+    }
 }