Class BaseTemplate
java.lang.Object
org.opendaylight.yangtools.binding.codegen.BaseTemplate
- Direct Known Subclasses:
AbstractBuilderTemplate
,ClassTemplate
,EnumTemplate
,InterfaceTemplate
-
Constructor Summary
ConstructorsConstructorDescriptionBaseTemplate
(org.opendaylight.yangtools.binding.codegen.AbstractJavaGeneratedType javaType, GeneratedType type) BaseTemplate
(GeneratedType type) -
Method Summary
Modifier and TypeMethodDescriptionprotected final CharSequence
asArguments
(Collection<GeneratedProperty> parameters) Template method which generates sequence of the names of the class attributes fromparameters
.protected final CharSequence
asArgumentsDeclaration
(Iterable<GeneratedProperty> parameters) Template method which generates method parameters with their types fromparameters
.protected final String
asJavadoc
(TypeMemberComment comment) Template method which generates JAVA comments.protected final CharSequence
asNonNullArgumentsDeclaration
(Iterable<GeneratedProperty> parameters) Template method which generates method parameters with their types fromparameters
, annotating them withNonNull
.protected CharSequence
checkArgument
(GeneratedProperty property, Restrictions restrictions, Type actualType, String value) protected CharSequence
protected String
protected String
formatDataForJavaDoc
(GeneratedType type, String additionalComment) static CharSequence
formatReference
(String reference) protected static String
formatToParagraph
(String inputText) protected final CharSequence
generateAnnotation
(AnnotationType annotation) protected CharSequence
generateCheckers
(GeneratedProperty field, Restrictions restrictions, Type actualType) protected CharSequence
generateParameters
(List<MethodSignature.Parameter> parameters) Template method which generates method parameters with their types fromparameters
.protected static Optional
<MethodSignature> getterByName
(Iterable<MethodSignature> methods, String implMethodName) protected CharSequence
getterMethod
(GeneratedProperty field) Template method which generates the getter method forfield
protected static String
propertyNameFromGetter
(String getterName) protected static String
protected final CharSequence
setterMethod
(GeneratedProperty field) Template method which generates the setter method forfield
static String
wrapToDocumentation
(String text)
-
Constructor Details
-
BaseTemplate
-
BaseTemplate
public BaseTemplate(org.opendaylight.yangtools.binding.codegen.AbstractJavaGeneratedType javaType, GeneratedType type)
-
-
Method Details
-
getterMethod
Template method which generates the getter method forfield
- Parameters:
field
- generated property with data about field which is generated as the getter method- Returns:
- string with the getter method source code in JAVA format
-
setterMethod
Template method which generates the setter method forfield
- Parameters:
field
- generated property with data about field which is generated as the setter method- Returns:
- string with the setter method source code in JAVA format
-
asArgumentsDeclaration
Template method which generates method parameters with their types fromparameters
.- Parameters:
parameters
- group of generated property instances which are transformed to the method parameters- Returns:
- string with the list of the method parameters with their types in JAVA format
-
asNonNullArgumentsDeclaration
Template method which generates method parameters with their types fromparameters
, annotating them withNonNull
.- Parameters:
parameters
- group of generated property instances which are transformed to the method parameters- Returns:
- string with the list of the method parameters with their types in JAVA format
-
asArguments
Template method which generates sequence of the names of the class attributes fromparameters
.- Parameters:
parameters
- group of generated property instances which are transformed to the sequence of parameter names- Returns:
- string with the list of the parameter names of the
parameters
-
asJavadoc
Template method which generates JAVA comments.- Parameters:
comment
- string with the comment for whole JAVA class- Returns:
- string with comment in JAVA format
-
wrapToDocumentation
-
formatDataForJavaDoc
-
formatDataForJavaDoc
-
formatReference
-
asLink
-
formatToParagraph
-
generateParameters
Template method which generates method parameters with their types fromparameters
.- Parameters:
parameters
- list of parameter instances which are transformed to the method parameters- Returns:
- string with the list of the method parameters with their types in JAVA format
-
emitConstant
-
generateCheckers
protected CharSequence generateCheckers(GeneratedProperty field, Restrictions restrictions, Type actualType) -
checkArgument
protected CharSequence checkArgument(GeneratedProperty property, Restrictions restrictions, Type actualType, String value) -
generateAnnotation
-
getterByName
protected static Optional<MethodSignature> getterByName(Iterable<MethodSignature> methods, String implMethodName) -
propertyNameFromGetter
-
propertyNameFromGetter
-