-/*
- * Copyright (c) 2013 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,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.yang.model.util;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.yang.common.QName;
-import org.opendaylight.controller.yang.model.api.SchemaPath;
-
-public final class BaseTypes {
-
- private BaseTypes() {}
-
- public static final URI BaseTypesNamespace = URI
- .create("urn:ietf:params:xml:ns:yang:1");
-
- /**
- * Construct QName for Built-in base Yang type. The namespace for
- * built-in base yang types is defined as: urn:ietf:params:xml:ns:yang:1
- *
- * @param typeName yang type name
- * @return built-in base yang type QName.
- */
- public static final QName constructQName(final String typeName) {
- return new QName(BaseTypesNamespace, typeName);
- }
-
- /**
- * Creates Schema Path from Qname.
- *
- * @param typeName yang type QName
- * @return Schema Path from Qname.
- */
- public static final SchemaPath schemaPath(final QName typeName) {
- final List<QName> pathList = new ArrayList<QName>();
- pathList.add(typeName);
- return new SchemaPath(pathList, true);
- }
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.controller.yang.model.util;\r
+\r
+import java.net.URI;\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+import java.util.List;\r
+\r
+import org.opendaylight.controller.yang.common.QName;\r
+import org.opendaylight.controller.yang.model.api.SchemaPath;\r
+\r
+public final class BaseTypes {\r
+\r
+ private BaseTypes() {}\r
+\r
+ public static final URI BaseTypesNamespace = URI\r
+ .create("urn:ietf:params:xml:ns:yang:1");\r
+\r
+ /**\r
+ * Construct QName for Built-in base Yang type. The namespace for\r
+ * built-in base yang types is defined as: urn:ietf:params:xml:ns:yang:1\r
+ * \r
+ * @param typeName yang type name\r
+ * @return built-in base yang type QName.\r
+ */\r
+ public static final QName constructQName(final String typeName) {\r
+ return new QName(BaseTypesNamespace, typeName);\r
+ }\r
+\r
+ /**\r
+ * Creates Schema Path from Qname.\r
+ * \r
+ * @param typeName yang type QName\r
+ * @return Schema Path from Qname.\r
+ */\r
+ public static final SchemaPath schemaPath(final QName typeName) {\r
+ final List<QName> pathList = new ArrayList<QName>();\r
+ pathList.add(typeName);\r
+ return new SchemaPath(pathList, true);\r
+ }\r
+ \r
+ /**\r
+ * Creates Schema Path from List of partial paths defined as Strings, module Namespace and\r
+ * module latest Revision Date.\r
+ * \r
+ * @param actualPath List of partial paths\r
+ * @param namespace Module Namespace\r
+ * @param revision Revision Date\r
+ * @return Schema Path\r
+ */\r
+ public static final SchemaPath schemaPath(final List<String> actualPath, final URI namespace, final Date revision) {\r
+ if (actualPath == null) {\r
+ throw new IllegalArgumentException("The actual path List MUST be specified.");\r
+ }\r
+ final List<QName> pathList = new ArrayList<QName>();\r
+ for (final String path : actualPath) {\r
+ final QName qname = new QName(namespace, revision, path);\r
+ if (qname != null) {\r
+ pathList.add(qname);\r
+ }\r
+ }\r
+ return new SchemaPath(pathList, true);\r
+ }\r
+}\r