Class BaseTemplate

java.lang.Object
org.opendaylight.yangtools.binding.codegen.BaseTemplate
Direct Known Subclasses:
AbstractBuilderTemplate, ClassTemplate, EnumTemplate, InterfaceTemplate

public abstract class BaseTemplate extends Object
  • Constructor Details

    • BaseTemplate

      public BaseTemplate(GeneratedType type)
    • BaseTemplate

      public BaseTemplate(org.opendaylight.yangtools.binding.codegen.AbstractJavaGeneratedType javaType, GeneratedType type)
  • Method Details

    • getterMethod

      protected CharSequence getterMethod(GeneratedProperty field)
      Template method which generates the getter method for field
      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

      protected final CharSequence setterMethod(GeneratedProperty field)
      Template method which generates the setter method for field
      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

      protected final CharSequence asArgumentsDeclaration(Iterable<GeneratedProperty> parameters)
      Template method which generates method parameters with their types from parameters.
      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

      protected final CharSequence asNonNullArgumentsDeclaration(Iterable<GeneratedProperty> parameters)
      Template method which generates method parameters with their types from parameters, annotating them with NonNull.
      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

      protected final CharSequence asArguments(Collection<GeneratedProperty> parameters)
      Template method which generates sequence of the names of the class attributes from parameters.
      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

      protected final String asJavadoc(TypeMemberComment comment)
      Template method which generates JAVA comments.
      Parameters:
      comment - string with the comment for whole JAVA class
      Returns:
      string with comment in JAVA format
    • wrapToDocumentation

      public static String wrapToDocumentation(String text)
    • formatDataForJavaDoc

      protected String formatDataForJavaDoc(GeneratedType type)
    • formatDataForJavaDoc

      protected String formatDataForJavaDoc(GeneratedType type, String additionalComment)
    • formatReference

      public static CharSequence formatReference(String reference)
    • asLink

      public String asLink(String text)
    • formatToParagraph

      protected static String formatToParagraph(String inputText)
    • generateParameters

      protected CharSequence generateParameters(List<MethodSignature.Parameter> parameters)
      Template method which generates method parameters with their types from parameters.
      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

      protected CharSequence emitConstant(Constant c)
    • generateCheckers

      protected CharSequence generateCheckers(GeneratedProperty field, Restrictions restrictions, Type actualType)
    • checkArgument

      protected CharSequence checkArgument(GeneratedProperty property, Restrictions restrictions, Type actualType, String value)
    • generateAnnotation

      protected final CharSequence generateAnnotation(AnnotationType annotation)
    • getterByName

      protected static Optional<MethodSignature> getterByName(Iterable<MethodSignature> methods, String implMethodName)
    • propertyNameFromGetter

      protected static String propertyNameFromGetter(MethodSignature getter)
    • propertyNameFromGetter

      protected static String propertyNameFromGetter(String getterName)