Bug 5882: Wrong placement of deprecated annotation
[mdsal.git] / binding / mdsal-binding-generator-impl / src / main / java / org / opendaylight / yangtools / sal / binding / generator / impl / YangTemplate.xtend
index a5b82e9c1a4444c12806a87be154c8ab1af34cf8..09764442ba356c8c79fa32d29f5587e40d621e6a 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.yangtools.sal.binding.generator.impl
 
+import com.google.common.base.CharMatcher
 import java.util.Collection
 import java.util.Date
 import java.util.List
@@ -14,6 +15,7 @@ import java.util.Map
 import java.util.Set
 import java.util.StringTokenizer
 import org.opendaylight.yangtools.yang.common.QName
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode
@@ -40,8 +42,6 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode
 import org.opendaylight.yangtools.yang.model.api.UsesNode
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil
-import com.google.common.base.CharMatcher
 
 class YangTemplate {
 
@@ -211,9 +211,6 @@ class YangTemplate {
     def static writeRPC(RpcDefinition rpc) {
         var boolean isStatusDeprecated = rpc.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             rpc «rpc.QName.localName» {
                 «IF !rpc.description.nullOrEmpty»
                     "«rpc.description»";
@@ -278,9 +275,6 @@ class YangTemplate {
     def static writeNotification(NotificationDefinition notification) {
         var boolean isStatusDeprecated = notification.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             notification «notification.QName.localName» {
                 «IF !notification.description.nullOrEmpty»
                 description
@@ -382,9 +376,6 @@ class YangTemplate {
     def static writeTypeDefinition(TypeDefinition<?> typeDefinition) {
         var boolean isStatusDeprecated = typeDefinition.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             type «typeDefinition.QName.localName»«IF !isStatusDeprecated»;«ELSE» {
                 status «typeDefinition.status»;
             }
@@ -475,12 +466,7 @@ class YangTemplate {
     }
 
     def static writeExtension(ExtensionDefinition extensionDef) {
-        var boolean isStatusDeprecated = extensionDef.status == Status::DEPRECATED
-
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             extension «extensionDef.QName.localName» {
                 «IF !extensionDef.description.nullOrEmpty»
                 description
@@ -582,9 +568,6 @@ class YangTemplate {
     def static writeGroupingDef(GroupingDefinition groupingDef) {
         var boolean isStatusDeprecated = groupingDef.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             grouping «groupingDef.QName.localName» {
                 «IF !groupingDef.groupings.nullOrEmpty»
                     «writeGroupingDefs(groupingDef.groupings)»
@@ -605,9 +588,6 @@ class YangTemplate {
     def static writeContSchemaNode(ContainerSchemaNode contSchemaNode) {
         var boolean isStatusDeprecated = contSchemaNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             container «contSchemaNode.getQName.localName» {
                 «IF !contSchemaNode.childNodes.nullOrEmpty»
                 «writeDataSchemaNodes(contSchemaNode.childNodes)»
@@ -634,9 +614,6 @@ class YangTemplate {
     def static writeAnyXmlSchemaNode(AnyXmlSchemaNode anyXmlSchemaNode) {
         var boolean isStatusDeprecated = anyXmlSchemaNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             anyxml «anyXmlSchemaNode.getQName.localName»«IF !isStatusDeprecated»;«ELSE» {
                 status «anyXmlSchemaNode.status»;
             }
@@ -647,9 +624,6 @@ class YangTemplate {
     def static writeLeafSchemaNode(LeafSchemaNode leafSchemaNode) {
         var boolean isStatusDeprecated = leafSchemaNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             leaf «leafSchemaNode.getQName.localName» {
                 type «leafSchemaNode.type.getQName.localName»;
                 «IF isStatusDeprecated»
@@ -662,9 +636,6 @@ class YangTemplate {
     def static writeLeafListSchemaNode(LeafListSchemaNode leafListSchemaNode) {
         var boolean isStatusDeprecated = leafListSchemaNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             leaf-list «leafListSchemaNode.getQName.localName» {
                 type «leafListSchemaNode.type.getQName.localName»;
                 «IF isStatusDeprecated»
@@ -677,9 +648,6 @@ class YangTemplate {
     def static writeChoiceCaseNode(ChoiceCaseNode choiceCaseNode) {
         var boolean isStatusDeprecated = choiceCaseNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             case «choiceCaseNode.getQName.localName» {
                 «FOR childNode : choiceCaseNode.childNodes»
                     «writeDataSchemaNode(childNode)»
@@ -694,9 +662,6 @@ class YangTemplate {
     def static writeChoiceNode(ChoiceSchemaNode choiceNode) {
         var boolean isStatusDeprecated = choiceNode.status == Status::DEPRECATED
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             choice «choiceNode.getQName.localName» {
                 «FOR child : choiceNode.cases»
                     «writeDataSchemaNode(child)»
@@ -712,9 +677,6 @@ class YangTemplate {
         var boolean isStatusDeprecated = listSchemaNode.status == Status::DEPRECATED
 
         '''
-            «IF isStatusDeprecated»
-            @deprecated - status DEPRECATED
-            «ENDIF»
             list «listSchemaNode.getQName.localName» {
                 key «FOR listKey : listSchemaNode.keyDefinition SEPARATOR " "»"«listKey.localName»"
                 «ENDFOR»
@@ -795,7 +757,6 @@ class YangTemplate {
         var boolean isFirstElementOnNewLineEmptyChar = false;
         val lineIndent = computeNextLineIndent(nextLineIndent);
 
-        formattedText = formattedText.replace("*/", "&#42;&#47;");
         formattedText = NEWLINE_OR_TAB.removeFrom(formattedText);
         formattedText = formattedText.replaceAll(" +", " ");