Do not generate 'isFoo()' methods
[mdsal.git] / binding / mdsal-binding-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / java / api / generator / InterfaceTemplate.xtend
index 799a0f85f5420c60ac55c38fcb6e55981f7afbfe..b41817df9b648b6300cb7d576af7c4ac27383db6 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.mdsal.binding.java.api.generator
 import static extension org.opendaylight.mdsal.binding.spec.naming.BindingMapping.getGetterMethodForNonnull
 import static extension org.opendaylight.mdsal.binding.spec.naming.BindingMapping.isGetterMethodName
 import static extension org.opendaylight.mdsal.binding.spec.naming.BindingMapping.isNonnullMethodName
-import static org.opendaylight.mdsal.binding.model.util.Types.STRING;
+import static org.opendaylight.mdsal.binding.model.util.Types.BOOLEAN
+import static org.opendaylight.mdsal.binding.model.util.Types.STRING
 import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.AUGMENTATION_FIELD
 import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BINDING_EQUALS_NAME
 import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.BINDING_HASHCODE_NAME
@@ -81,6 +82,7 @@ class InterfaceTemplate extends BaseTemplate {
     override body() '''
         «type.formatDataForJavaDoc.wrapToDocumentation»
         «type.annotations.generateAnnotations»
+        «generatedAnnotation»
         public interface «type.name»
             «superInterfaces»
         {
@@ -105,6 +107,17 @@ class InterfaceTemplate extends BaseTemplate {
         «ENDIF»
     '''
 
+    def private generateAccessorAnnotations(MethodSignature method) '''
+         «val annotations = method.annotations»
+         «IF annotations !== null && !annotations.empty»
+             «FOR annotation : annotations»
+                  «IF method.returnType != BOOLEAN || !(annotation.identifier == OVERRIDE)»
+                      «annotation.generateAnnotation»
+                  «ENDIF»
+             «ENDFOR»
+        «ENDIF»
+    '''
+
     /**
      * Template method which generates the interface name declaration.
      *
@@ -224,7 +237,7 @@ class InterfaceTemplate extends BaseTemplate {
         val propReturn = method.propertyNameFromGetter + ", or " + orString + " if it is not present."
 
         return wrapToDocumentation('''
-            Return «propReturn».
+            Return «propReturn»
 
             «reference.formatReference»
             @return {@code «method.returnType.fullyQualifiedName»} «propReturn»
@@ -234,7 +247,7 @@ class InterfaceTemplate extends BaseTemplate {
     def private generateAccessorMethod(MethodSignature method) {
         return '''
             «accessorJavadoc(method, "{@code null}")»
-            «method.annotations.generateAnnotations»
+            «method.generateAccessorAnnotations»
             «method.returnType.nullableType» «method.name»();
         '''
     }