public final class TextTemplateUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
asArguments(List<GeneratedProperty> parameters)
Template method which generates sequence of the names of the class attributes.
|
static String |
asJavadoc(String comment)
Template method which generates JAVA comments.
|
static String |
encodeAngleBrackets(String description)
Encodes angle brackets in yang statement description.
|
static String |
fieldName(GeneratedProperty property)
sets fieldname according to property for return type.
|
static String |
formatDataForJavaDoc(GeneratedType type)
Returns formatted type description.
|
static String |
formatDataForJavaDoc(GeneratedType type,
String additionalComment)
Returns formatted Javadoc with possible additional comment, based on type.
|
static String |
formatDataForJavaDocBuilder(String typeName)
Returns formatted Javadoc, based on type.
|
static String |
formatSchemaPath(String moduleName,
Iterable<org.opendaylight.yangtools.yang.common.QName> schemaPath) |
static String |
getAccessModifier(AccessModifier modifier)
Util method for unionTemplateBuilderTemplate.
|
static String |
getClarification()
util method for unionTemplateBuilderTemplate.
|
static String |
getJavaDocForInterface(MethodSignature methodSignature)
Returns related Javadoc.
|
static String |
getPropertyList(List<GeneratedProperty> properties)
Returns list of properties as formatted String.
|
static Restrictions |
getRestrictions(Type currentType)
Extracts available restrictions from given type.
|
static String |
getSimpleNameForBuilder()
Returns simple name of underlying class.
|
static String |
getSourcePath(org.opendaylight.yangtools.yang.model.api.Module module,
Function<org.opendaylight.yangtools.yang.model.api.Module,Optional<String>> moduleFilePathResolver)
Returns source path as String.
|
static String |
getterMethodName(GeneratedProperty field)
Helper method for building getter.
|
static boolean |
hasBuilderClass(GeneratedType type) |
static String |
paramValue(Type returnType,
String paramName)
Returns parameter name, based on given Type.
|
static String |
propertyNameFromGetter(MethodSignature getter)
Cuts prefix from getter name.
|
static String |
propsAsArgs(Iterable<GeneratedProperty> properties)
Returns collection of properties as formatted String.
|
static String |
propsAsList(Iterable<GeneratedProperty> properties,
String booleanName)
Returns properties as formatted String.
|
static String |
setterMethod(GeneratedProperty field,
String typeName,
String returnTypeName)
Returns built setter method body from input parameters.
|
static String |
toFirstLower(String str)
Makes start of getter name LowerCase.
|
static String |
toFirstUpper(String str)
Makes start of getter name uppercase.
|
static String |
valueForBits(List<GeneratedProperty> properties)
Returns properties names in formatted string.
|
static String |
wrapToDocumentation(String text)
Wraps text as documentation, used in enum description.
|
public static final String DOT
public static String toFirstLower(String str)
str
- getter name without prefixpublic static String wrapToDocumentation(String text)
text
- text for wrappingpublic static String formatDataForJavaDocBuilder(String typeName)
typeName
- given type namepublic static String formatDataForJavaDoc(GeneratedType type, String additionalComment)
type
- given typeadditionalComment
- additional comment to formatpublic static String formatDataForJavaDoc(GeneratedType type)
type
- given typepublic static boolean hasBuilderClass(GeneratedType type)
public static String formatSchemaPath(String moduleName, Iterable<org.opendaylight.yangtools.yang.common.QName> schemaPath)
public static String valueForBits(List<GeneratedProperty> properties)
properties
- list of given propertiespublic static String paramValue(Type returnType, String paramName)
returnType
- given typeparamName
- parameter namepublic static String asJavadoc(String comment)
comment
- comment string with the comment for whole JAVA classpublic static String getJavaDocForInterface(MethodSignature methodSignature)
methodSignature
- method signaturepublic static String encodeAngleBrackets(String description)
description
- description of a yang statement which is used to generate javadoc commentspublic static String propsAsArgs(Iterable<GeneratedProperty> properties)
properties
- list of given propertiespublic static String propsAsList(Iterable<GeneratedProperty> properties, String booleanName)
properties
- list of given propertiesbooleanName
- Java Boolean type namepublic static Restrictions getRestrictions(Type currentType)
currentType
- given typepublic static String fieldName(GeneratedProperty property)
property
- type from getterpublic static String asArguments(List<GeneratedProperty> parameters)
parameters
- group of generated property instances which are transformed to the sequence of parameter namespublic static String getterMethodName(GeneratedProperty field)
field
- property namepublic static String setterMethod(GeneratedProperty field, String typeName, String returnTypeName)
field
- generated propertytypeName
- type namereturnTypeName
- return type namepublic static String getSimpleNameForBuilder()
public static String toFirstUpper(String str)
str
- getter name without prefixpublic static String propertyNameFromGetter(MethodSignature getter)
getter
- getter namepublic static String getPropertyList(List<GeneratedProperty> properties)
properties
- input list of generated propertiespublic static String getClarification()
public static String getSourcePath(org.opendaylight.yangtools.yang.model.api.Module module, Function<org.opendaylight.yangtools.yang.model.api.Module,Optional<String>> moduleFilePathResolver)
module
- modulemoduleFilePathResolver
- function module to module file pathpublic static String getAccessModifier(AccessModifier modifier)
modifier
- enum representing Java access modifierCopyright © 2019 OpenDaylight. All rights reserved.