Class ClassTemplate
java.lang.Object
org.opendaylight.yangtools.binding.codegen.BaseTemplate
org.opendaylight.yangtools.binding.codegen.ClassTemplate
- Direct Known Subclasses:
ListKeyTemplate
,UnionTemplate
Template for generating JAVA class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List
<GeneratedProperty> List of constant instances which are generated as JAVA public static final attributes.protected final List
<Enumeration> List of enumeration which are generated as JAVA enum type.protected final List
<GeneratedProperty> protected final GeneratedTransferObject
protected final List
<GeneratedProperty> protected final List
<GeneratedProperty> protected final Restrictions
-
Constructor Summary
ConstructorsConstructorDescriptionClassTemplate
(org.opendaylight.yangtools.binding.codegen.AbstractJavaGeneratedType javaType, GeneratedTransferObject genType) Creates instance of this class with concretegenType
.ClassTemplate
(GeneratedTransferObject genType) Creates instance of this class with concretegenType
. -
Method Summary
Modifier and TypeMethodDescriptionprotected CharSequence
protected CharSequence
bitsArgs()
protected CharSequence
body()
protected CharSequence
Template method which generates JAVA constants.protected CharSequence
protected CharSequence
protected CharSequence
protected CharSequence
Template method which generates JAVA enum type.protected String
protected CharSequence
genConstructor
(GeneratedProperty property, Iterable<GeneratedProperty> other) Generates JAVA class source code (class body only).protected CharSequence
generateBody
(boolean isInnerClass) Template method which generates class body.protected CharSequence
generateClassDeclaration
(boolean isInnerClass) Template method which generates JAVA class declaration.protected CharSequence
Template method which generates JAVA class attributes.protected String
Template method which generates the methodhashCode()
.generateRestrictions
(Type type, String paramName, Type returnType) protected CharSequence
getPropByName
(String name) protected static Optional
<MethodSignature> getterByName
(Iterable<MethodSignature> methods, String implMethodName) protected CharSequence
Template method which generates inner classes inside this interface.protected boolean
isReadOnly
(GeneratedProperty field) protected CharSequence
protected CharSequence
protected static String
propertyNameFromGetter
(String getterName) protected static String
protected CharSequence
propsAsArgs
(Iterable<GeneratedProperty> properties) protected CharSequence
Methods inherited from class org.opendaylight.yangtools.binding.codegen.BaseTemplate
asArguments, asArgumentsDeclaration, asJavadoc, asLink, asNonNullArgumentsDeclaration, checkArgument, emitConstant, formatDataForJavaDoc, formatDataForJavaDoc, formatReference, formatToParagraph, generateAnnotation, generateCheckers, generateParameters, getterMethod, setterMethod, wrapToDocumentation
-
Field Details
-
properties
-
finalProperties
-
parentProperties
-
allProperties
-
restrictions
-
enums
List of enumeration which are generated as JAVA enum type. -
consts
List of constant instances which are generated as JAVA public static final attributes. -
genTO
-
-
Constructor Details
-
ClassTemplate
Creates instance of this class with concretegenType
.- Parameters:
genType
- generated transfer object which will be transformed to JAVA class source code
-
ClassTemplate
public ClassTemplate(org.opendaylight.yangtools.binding.codegen.AbstractJavaGeneratedType javaType, GeneratedTransferObject genType) Creates instance of this class with concretegenType
.- Parameters:
genType
- generated transfer object which will be transformed to JAVA class source code
-
-
Method Details
-
generateAsInnerClass
Generates JAVA class source code (class body only).- Returns:
- string with JAVA class body source code
-
body
-
generateBody
Template method which generates class body.- Parameters:
isInnerClass
- boolean value which specify if generated class is|isn't inner- Returns:
- string with class source code in JAVA format
-
propertyMethods
-
innerClassesDeclarations
Template method which generates inner classes inside this interface.- Returns:
- string with the source code for inner classes in JAVA format
-
constructors
-
allValuesConstructor
-
genUnionConstructor
-
genConstructor
protected CharSequence genConstructor(GeneratedProperty property, Iterable<GeneratedProperty> other) -
generateRestrictions
-
copyConstructor
-
parentConstructor
-
defaultInstance
-
bitsArgs
-
propsAsArgs
-
generateClassDeclaration
Template method which generates JAVA class declaration.- Parameters:
isInnerClass
- boolean value which specify if generated class is|isn't inner- Returns:
- string with class declaration in JAVA format
-
finalClass
-
enumDeclarations
Template method which generates JAVA enum type.- Returns:
- string with inner enum source code in JAVA format
-
suidDeclaration
-
annotationDeclaration
-
constantsDeclarations
Template method which generates JAVA constants.- Returns:
- string with constants in JAVA format
-
generateFields
Template method which generates JAVA class attributes.- Returns:
- string with the class attributes in JAVA format
-
isReadOnly
-
generateHashCode
Template method which generates the methodhashCode()
.- Returns:
- string with the
hashCode()
method definition in JAVA format
-
getPropByName
-
getterByName
protected static Optional<MethodSignature> getterByName(Iterable<MethodSignature> methods, String implMethodName) -
propertyNameFromGetter
-
propertyNameFromGetter
-