X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=code-generator%2Fbinding-java-api-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fsal%2Fjava%2Fapi%2Fgenerator%2FBaseTemplate.xtend;h=152d60e6de6b5f933addf4714e41f4da702dbae7;hb=refs%2Fchanges%2F44%2F9144%2F15;hp=eb7b948c545283c6e7e3d162a202574365eb0723;hpb=b8ac1a71bb9b2f950f8b55c8357aac777a63a83c;p=yangtools.git diff --git a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BaseTemplate.xtend b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BaseTemplate.xtend index eb7b948c54..152d60e6de 100644 --- a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BaseTemplate.xtend +++ b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/BaseTemplate.xtend @@ -190,70 +190,15 @@ abstract class BaseTemplate { } def protected String formatDataForJavaDoc(GeneratedType type) { - val typeDescription = type.description - val typeReference = type.reference - val typeModuleName = type.moduleName - val typeSchemaPath = type.schemaPath + val typeDescription = type.getDescription(); return ''' - «IF !type.isDocumentationParametersNullOrEmtpy» - «IF typeDescription != null && !typeDescription.empty» - «formatToParagraph(typeDescription)» - «ENDIF» - «IF typeReference != null && !typeReference.empty» - Reference: - «formatReference(typeReference)» - «ENDIF» - «IF typeModuleName != null && !typeModuleName.empty» - Module name: - «typeModuleName» - «ENDIF» - «IF typeSchemaPath != null && !typeSchemaPath.empty» - Schema path: - «formatPath(typeSchemaPath)» - «ENDIF» + «IF !typeDescription.nullOrEmpty» + «typeDescription» «ENDIF» '''.toString } - def formatPath(Iterable schemaPath) { - var currentElement = schemaPath.head - val StringBuilder sb = new StringBuilder() - sb.append('[') - sb.append(currentElement) - - for(pathElement : schemaPath) { - if(!currentElement.namespace.equals(pathElement.namespace)) { - currentElement = pathElement - sb.append('/') - sb.append(pathElement) - } - else { - sb.append('/') - sb.append(pathElement.localName) - } - } - sb.append(']') - return sb.toString - } - - def formatReference(String reference) { - if(reference == null || reference.isEmpty) - return reference - - val StringTokenizer tokenizer = new StringTokenizer(reference, " ", true) - val StringBuilder sb = new StringBuilder(); - - while(tokenizer.hasMoreTokens) { - var String oneElement = tokenizer.nextToken - if (oneElement.contains("http://")) { - oneElement = asLink(oneElement) - } - sb.append(oneElement) - } - return sb.toString - } - def asLink(String text) { val StringBuilder sb = new StringBuilder() var tempText = text @@ -329,29 +274,16 @@ abstract class BaseTemplate { } def isDocumentationParametersNullOrEmtpy(GeneratedType type) { - var boolean isNullOrEmpty = true - val String typeDescription = type.description - val String typeReference = type.reference - val String typeModuleName = type.moduleName - val Iterable typeSchemaPath = type.schemaPath - - if(typeDescription != null && !typeDescription.empty) { - isNullOrEmpty = false - return isNullOrEmpty - } - if(typeReference != null && !typeReference.empty) { - isNullOrEmpty = false - return isNullOrEmpty - } - if(typeModuleName != null && !typeModuleName.empty) { - isNullOrEmpty = false - return isNullOrEmpty - } - if(typeSchemaPath != null && !typeSchemaPath.empty) { - isNullOrEmpty = false - return isNullOrEmpty + val boolean isTypeDescriptionNullOrEmpty = type.description.nullOrEmpty + val boolean isTypeReferenceNullOrEmpty = type.reference.nullOrEmpty + val boolean isTypeModuleNameNullOrEmpty = type.moduleName.nullOrEmpty + val boolean isTypeSchemaPathNullOrEmpty = type.schemaPath.nullOrEmpty + + if (isTypeDescriptionNullOrEmpty && isTypeReferenceNullOrEmpty && isTypeModuleNameNullOrEmpty + && isTypeSchemaPathNullOrEmpty) { + return true } - return isNullOrEmpty + return false } def generateRestrictions(Type type, String paramName, Type returnType) '''