Add missing copyright headers
[yangtools.git] / code-generator / binding-java-api-generator / src / main / java / org / opendaylight / yangtools / sal / java / api / generator / ClassTemplate.xtend
index d26c3bb8bfeaf92a9131c2306b7d9e3a39e1cb55..25236bcfd1ebcba5b8b7ea8d92f6f5f3ad0172db 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 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.yangtools.sal.java.api.generator\r
 \r
 import java.util.List\r
@@ -423,6 +430,18 @@ class ClassTemplate extends BaseTemplate {
     '''\r
 \r
     def private generateGetLength() '''\r
+        «IF restrictions != null && !(restrictions.lengthConstraints.empty)»\r
+            public static «List.importedName»<«Range.importedName»<Integer>> getLength() {\r
+                final «List.importedName»<«Range.importedName»<Integer>> result = new «ArrayList.importedName»<>();\r
+                «FOR r : restrictions.lengthConstraints»\r
+                    result.add(«Range.importedName».closed(«r.min», «r.max»));\r
+                «ENDFOR»\r
+                return result;\r
+            }\r
+        «ENDIF»\r
+    '''\r
+\r
+    def private generateGetRange() '''\r
         «IF restrictions != null && !(restrictions.lengthConstraints.empty)»\r
             public static «List.importedName»<«Range.importedName»<Integer>> getLength() {\r
                 final «List.importedName»<«Range.importedName»<Integer>> result = new «ArrayList.importedName»<>();\r