Merge "Eliminate all trailing whitespace in xtend"
authorTony Tkacik <ttkacik@cisco.com>
Thu, 12 Mar 2015 17:10:46 +0000 (17:10 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 12 Mar 2015 17:10:46 +0000 (17:10 +0000)
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BuilderTemplate.xtend
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/EnumTemplate.xtend
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/InterfaceTemplate.xtend
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/UnionTemplate.xtend
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend

index a15d014fe937267e6549989bcccb7855b9b9f5e8..15e93756576ab94104cd4d33549e8b486937e6f9 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.yangtools.yang.binding.Identifiable
 import org.opendaylight.yangtools.concepts.Builder
 
 /**
- * Template for generating JAVA builder classes. 
+ * Template for generating JAVA builder classes.
  */
 
 class BuilderTemplate extends BaseTemplate {
@@ -84,7 +84,7 @@ class BuilderTemplate extends BaseTemplate {
     /**
      * Returns set of method signature instances which contains all the methods of the <code>genType</code>
      * and all the methods of the implemented interfaces.
-     * 
+     *
      * @returns set of method signature instances
      */
     def private Set<MethodSignature> createMethods() {
@@ -97,9 +97,9 @@ class BuilderTemplate extends BaseTemplate {
     }
 
     /**
-     * Adds to the <code>methods</code> set all the methods of the <code>implementedIfcs</code> 
+     * Adds to the <code>methods</code> set all the methods of the <code>implementedIfcs</code>
      * and recursively their implemented interfaces.
-     * 
+     *
      * @param methods set of method signatures
      * @param implementedIfcs list of implemented interfaces
      */
@@ -132,7 +132,7 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Returns the first element of the list <code>elements</code>.
-     * 
+     *
      * @param list of elements
      */
     def private <E> first(List<E> elements) {
@@ -141,7 +141,7 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Returns the name of the package from <code>fullyQualifiedName</code>.
-     * 
+     *
      * @param fullyQualifiedName string with fully qualified type name (package + type)
      * @return string with the package name
      */
@@ -163,8 +163,8 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Creates set of generated property instances from getter <code>methods</code>.
-     * 
-     * @param set of method signature instances which should be transformed to list of properties 
+     *
+     * @param set of method signature instances which should be transformed to list of properties
      * @return set of generated property instances which represents the getter <code>methods</code>
      */
     def private propertiesFromMethods(Collection<MethodSignature> methods) {
@@ -183,7 +183,7 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Creates generated property instance from the getter <code>method</code> name and return type.
-     * 
+     *
      * @param method method signature from which is the method name and return type obtained
      * @return generated property instance for the getter <code>method</code>
      * @throws IllegalArgumentException<ul>
@@ -200,7 +200,7 @@ class BuilderTemplate extends BaseTemplate {
         var prefix = "get";
         if(Types.BOOLEAN.equals(method.returnType)) {
             prefix = "is";
-        } 
+        }
         if (method.name.startsWith(prefix)) {
             val fieldName = method.getName().substring(prefix.length()).toFirstLower
             val tmpGenTO = new GeneratedTOBuilderImpl("foo", "foo")
@@ -210,8 +210,8 @@ class BuilderTemplate extends BaseTemplate {
     }
 
     /**
-     * Template method which generates JAVA class body for builder class and for IMPL class. 
-     * 
+     * Template method which generates JAVA class body for builder class and for IMPL class.
+     *
      * @return string with JAVA source code
      */
     override body() '''
@@ -251,7 +251,7 @@ class BuilderTemplate extends BaseTemplate {
                 «generateHashCode()»
 
                 «generateEquals()»
-                
+
                 «generateToString(properties)»
             }
 
@@ -263,7 +263,7 @@ class BuilderTemplate extends BaseTemplate {
      */
     def private generateConstructorsFromIfcs(Type type) '''
         public «type.name»«BUILDER»() {
-        } 
+        }
         «IF (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject))»
             «val ifc = type as GeneratedType»
             «FOR impl : ifc.implements»
@@ -378,7 +378,7 @@ class BuilderTemplate extends BaseTemplate {
                 baseIfcs.add(ifc)
             }
         }
-        return baseIfcs 
+        return baseIfcs
     }
 
     private def Set<Type> getAllIfcs(Type type) {
@@ -392,7 +392,7 @@ class BuilderTemplate extends BaseTemplate {
                 baseIfcs.addAll(impl.getAllIfcs)
             }
         }
-        return baseIfcs 
+        return baseIfcs
     }
 
     private def List<String> toListOfNames(Collection<Type> types) {
@@ -566,7 +566,7 @@ class BuilderTemplate extends BaseTemplate {
                             break;
                             case 1:
                                 final «Map.importedName».Entry<«Class.importedName»<? extends «augmentField.returnType.importedName»>, «augmentField.returnType.importedName»> e = «prop».«augmentField.name».entrySet().iterator().next();
-                                this.«augmentField.name» = «Collections.importedName».<«Class.importedName»<? extends «augmentField.returnType.importedName»>, «augmentField.returnType.importedName»>singletonMap(e.getKey(), e.getValue());       
+                                this.«augmentField.name» = «Collections.importedName».<«Class.importedName»<? extends «augmentField.returnType.importedName»>, «augmentField.returnType.importedName»>singletonMap(e.getKey(), e.getValue());
                             break;
                         default :
                             this.«augmentField.name» = new «HashMap.importedName»<>(«prop».«augmentField.name»);
@@ -611,7 +611,7 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Template method which generate getter methods for IMPL class.
-     * 
+     *
      * @return string with getter methods
      */
     def private generateGetters(boolean addOverride) '''
@@ -636,7 +636,7 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Template method which generates the method <code>hashCode()</code>.
-     * 
+     *
      * @return string with the <code>hashCode()</code> method definition in JAVA format
      */
     def protected generateHashCode() '''
@@ -662,8 +662,8 @@ class BuilderTemplate extends BaseTemplate {
 
     /**
      * Template method which generates the method <code>equals()</code>.
-     * 
-     * @return string with the <code>equals()</code> method definition in JAVA format     
+     *
+     * @return string with the <code>equals()</code> method definition in JAVA format
      */
     def protected generateEquals() '''
         «IF !properties.empty || augmentField != null»
@@ -768,15 +768,15 @@ class BuilderTemplate extends BaseTemplate {
         return «type.importedName».class;
     }
     '''
-    
+
     private def createDescription(GeneratedType type) {
         return '''
         Class that builds {@link «type.importedName»} instances.
-        
+
         @see «type.importedName»
     '''
     }
-    
+
     override def protected String formatDataForJavaDoc(GeneratedType type) {
         val typeDescription = createDescription(type)
 
index 417451bc181eee82bc51d14c51909aeb56430d8c..92466b2bd2b2d7ad8e27360ddca0c982dc860cc6 100644 (file)
@@ -11,36 +11,36 @@ import org.opendaylight.yangtools.sal.binding.model.api.Enumeration
 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType
 
 /**
- * Template for generating JAVA enumeration type. 
+ * Template for generating JAVA enumeration type.
  */
 class EnumTemplate extends BaseTemplate {
 
-    
+
     /**
      * Enumeration which will be transformed to JAVA source code for enumeration
      */
     val Enumeration enums
-    
+
     /**
      * Constructs instance of this class with concrete <code>enums</code>.
-     * 
-     * @param enums enumeration which will be transformed to JAVA source code 
+     *
+     * @param enums enumeration which will be transformed to JAVA source code
      */
     new(Enumeration enums) {
         super(enums as GeneratedType )
         this.enums = enums
     }
-    
-    
+
+
     /**
      * Generates only JAVA enumeration source code.
-     * 
+     *
      * @return string with JAVA enumeration source code
      */
     def generateAsInnerClass() {
         return body
     }
-    
+
     def writeEnumItem(String name, int value, String description) '''
         «asJavadoc(formatToParagraph(description))»
         «name»(«value»)
@@ -48,8 +48,8 @@ class EnumTemplate extends BaseTemplate {
 
     /**
      * Template method which generates enumeration body (declaration + enumeration items).
-     * 
-     * @return string with the enumeration body 
+     *
+     * @return string with the enumeration body
      */
     override body() '''
         «wrapToDocumentation(formatDataForJavaDoc(enums))»
@@ -69,11 +69,11 @@ class EnumTemplate extends BaseTemplate {
 
                 VALUE_MAP = b.build();
             }
-        
+
             private «enums.name»(int value) {
                 this.value = value;
             }
-            
+
             /**
              * @return integer value
              */
index 606fd753718b096bee210193b44231bd9ef3318c..acca70de9020dd151f5f63351562bb740c740c49 100644 (file)
@@ -16,34 +16,34 @@ import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType
 import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature\rimport org.opendaylight.yangtools.sal.binding.model.api.AnnotationType
 
 /**
- * Template for generating JAVA interfaces. 
+ * Template for generating JAVA interfaces.
  */
 class InterfaceTemplate extends BaseTemplate {
-    
+
     /**
      * List of constant instances which are generated as JAVA public static final attributes.
      */
     val List<Constant> consts
-    
+
     /**
      * List of method signatures which are generated as method declarations.
      */
     val List<MethodSignature> methods
-    
+
     /**
      * List of enumeration which are generated as JAVA enum type.
      */
     val List<Enumeration> enums
-    
+
     /**
      * List of generated types which are enclosed inside <code>genType</code>
      */
     val List<GeneratedType> enclosedGeneratedTypes
-    
+
     /**
-     * Creates the instance of this class which is used for generating the interface file source 
+     * Creates the instance of this class which is used for generating the interface file source
      * code from <code>genType</code>.
-     * 
+     *
      * @throws IllegalArgumentException if <code>genType</code> equals <code>null</code>
      */
     new(GeneratedType genType) {
@@ -51,16 +51,16 @@ class InterfaceTemplate extends BaseTemplate {
         if (genType == null) {
             throw new IllegalArgumentException("Generated type reference cannot be NULL!")
         }
-        
+
         consts = genType.constantDefinitions
         methods = genType.methodDefinitions
         enums = genType.enumerations
         enclosedGeneratedTypes = genType.enclosedTypes
     }
-    
+
     /**
      * Template method which generate the whole body of the interface.
-     * 
+     *
      * @return string with code for interface body in JAVA format
      */
     override body() '''
@@ -68,19 +68,19 @@ class InterfaceTemplate extends BaseTemplate {
         public interface «type.name»
             «superInterfaces»
         {
-        
+
             «generateInnerClasses»
-        
+
             «generateEnums»
-        
+
             «generateConstants»
-        
+
             «generateMethods»
-        
+
         }
-        
+
     '''
-   
+
 
     def private generateAnnotations(List<AnnotationType> annotations) '''
         «IF annotations != null && !annotations.empty»
@@ -99,10 +99,10 @@ class InterfaceTemplate extends BaseTemplate {
 
     /**
      * Template method which generates the interface name declaration.
-     * 
+     *
      * @return string with the code for the interface declaration in JAVA format
      */
-    def private superInterfaces() 
+    def private superInterfaces()
     '''
     «IF (!type.implements.empty)»
          extends
@@ -114,7 +114,7 @@ class InterfaceTemplate extends BaseTemplate {
 
     /**
      * Template method which generates inner classes inside this interface.
-     * 
+     *
      * @return string with the source code for inner classes in JAVA format
      */
     def private generateInnerClasses() '''
@@ -138,9 +138,9 @@ class InterfaceTemplate extends BaseTemplate {
 
     /**
      * Template method which generates JAVA enum type.
-     * 
+     *
      * @return string with inner enum source code in JAVA format
-     */    
+     */
     def private generateEnums() '''
         «IF !enums.empty»
             «FOR e : enums SEPARATOR "\n"»
@@ -149,12 +149,12 @@ class InterfaceTemplate extends BaseTemplate {
             «ENDFOR»
         «ENDIF»
     '''
-    
+
     /**
      * Template method wich generates JAVA constants.
-     * 
-     * @return string with constants in JAVA format 
-     */    
+     *
+     * @return string with constants in JAVA format
+     */
     def private generateConstants() '''
         «IF !consts.empty»
             «FOR c : consts»
@@ -167,9 +167,9 @@ class InterfaceTemplate extends BaseTemplate {
 
     /**
      * Template method which generates the declaration of the methods.
-     * 
-     * @return string with the declaration of methods source code in JAVA format 
-     */    
+     *
+     * @return string with the declaration of methods source code in JAVA format
+     */
     def private generateMethods() '''
         «IF !methods.empty»
             «FOR m : methods SEPARATOR "\n"»
index e8ddb9673f423e1e48a9280c744b3d9da726c79a..78c2cd05253179c4bd7b3cc5b7329ef87e2509b8 100644 (file)
@@ -13,13 +13,13 @@ import org.opendaylight.yangtools.sal.binding.model.api.Enumeration
 import static org.opendaylight.yangtools.binding.generator.util.Types.*
 
 /**
- * Template for generating JAVA class. 
+ * Template for generating JAVA class.
  */
 class UnionTemplate extends ClassTemplate {
 
     /**
      * Creates instance of this class with concrete <code>genType</code>.
-     * 
+     *
      * @param genType generated transfer object which will be transformed to JAVA class source code
      */
     new(GeneratedTransferObject genType) {
@@ -44,7 +44,7 @@ class UnionTemplate extends ClassTemplate {
             «IF isCharArray»
                 /**
                  * Constructor provided only for using in JMX. Don't use it for
-                 * construction new object of this union type. 
+                 * construction new object of this union type.
                  */
                 @«ConstructorProperties.importedName»("«property.name»")
                 public «type.name»(«propRet.importedName» «property.fieldName») {
@@ -84,10 +84,10 @@ class UnionTemplate extends ClassTemplate {
                                     this.«other.fieldName» = «property.fieldName».getValue();
                                 «ELSEIF propRet instanceof GeneratedTransferObject // Is it a GeneratedTransferObject
                                         && (propRet as GeneratedTransferObject).typedef  // Is it a typedef
-                                        && (propRet as GeneratedTransferObject).properties != null 
-                                        && !(propRet as GeneratedTransferObject).properties.empty 
-                                        && ((propRet as GeneratedTransferObject).properties.size == 1) 
-                                        && (propRet as GeneratedTransferObject).properties.get(0).name.equals("value") 
+                                        && (propRet as GeneratedTransferObject).properties != null
+                                        && !(propRet as GeneratedTransferObject).properties.empty
+                                        && ((propRet as GeneratedTransferObject).properties.size == 1)
+                                        && (propRet as GeneratedTransferObject).properties.get(0).name.equals("value")
                                         && BOOLEAN.equals((propRet as GeneratedTransferObject).properties.get(0).returnType)» // And the property value is of type boolean
                                     ««« generated boolean typedef
                                     this.«other.fieldName» = «property.fieldName».isValue().toString().toCharArray();
index 9e27693962e037f36098a54754b4cb6f347c8e36..64693702ff05b90f4fcd6f92e0e822385ed09d96 100644 (file)
@@ -64,7 +64,7 @@ class YangModuleInfoTemplate {
                 «val DateFormat df = new SimpleDateFormat("yyyy-MM-dd")»
                 private final «String.importedName» revision = "«df.format(module.revision)»";
                 private final «String.importedName» resourcePath = "«sourcePath»";
-                
+
                 private final «Set.importedName»<YangModuleInfo> importedModules;
 
                 public static «YangModuleInfo.importedName» getInstance() {
@@ -190,7 +190,7 @@ class YangModuleInfoTemplate {
         return "/" + module.moduleSourcePath.replace(java.io.File.separatorChar, '/')
     }
 
-    private def imports() ''' 
+    private def imports() '''
         «IF !importMap.empty»
             «FOR entry : importMap.entrySet»
                 «IF entry.value != getRootPackageName(module.QNameModule)»