Interface NamingStrategy

All Known Implementing Classes:
AbstractNamingStrategy, S4HanaNamingStrategy, SimpleNamingStrategy

@Beta public interface NamingStrategy
Represents a strategy for generating various types of Java names from OData entity/property names and labels.
  • Method Details

    • getNameSource

      @Nonnull NameSource getNameSource()
      Returns the NameSource used by this NamingStrategy.
      Returns:
      The used NameSource.
    • setNameSource

      void setNameSource(@Nonnull NameSource nameSource)
      Sets the NameSource that should be used by this NamingStrategy.
      Parameters:
      nameSource - The NameSource to use.
    • isReservedKeyword

      boolean isReservedKeyword(@Nonnull String name)
      Determines whether the proposedName is a language reserved keyword.
      Parameters:
      name - String to check
      Returns:
      true if proposedName is a reserved keyword, false otherwise.
    • generateJavaClassName

      @Nonnull String generateJavaClassName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the name and the label of an OData entity type into a suitable Java class name. The resulting name is used to generate the following:
      • Class that represents the entity type
      • Entity retrieval fluent helpers (...FluentHelper and ...ByKeyFluentHelper)
      • Entity modification fluent helpers (...CreateFluentHelper, ...UpdateFluentHelper, ...DeleteFluentHelper)
      Parameters:
      name - Provided by the VDM generator. It reads the Name attribute value of an EntityType tag in the metadata file.
      label - Provided by the VDM generator. I reads the sap:label attribute of an EntityType tag in the metadata file.
      Returns:
      A suitable Java class name that the VDM generator will use to create new VDM classes.
    • generateJavaFieldName

      @Nonnull String generateJavaFieldName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the name and the label of a property within an OData entity type into a suitable Java member variable name. These are the members of VDM entity classes that hold the values of entity properties.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a Property tag, which is within an EntityType tag.
      label - Provided by the VDM generator. In the metadata file, it reads the sap:label attribute value of a Property tag, which is within an EntityType tag.
      Returns:
      A suitable Java member variable name that the VDM generator will use to create a member variable in the newly generated VDM entity class.
    • generateJavaConstantName

      @Nonnull String generateJavaConstantName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the property name and the label of an OData entity type into a suitable Java constant (public static final) name. These constants are the fluent helper fields and they end up in the newly generated VDM entity classes.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a Property tag, which is within an EntityType tag.
      label - Provided by the VDM generator. In the metadata file, it reads the sap:label attribute value of a Property tag, which is within an EntityType tag.
      Returns:
      A suitable Java constant name that the VDM generator will use to create a constant in the newly generated VDM entity class.
    • generateJavaNavigationPropertyFieldName

      @Nonnull String generateJavaNavigationPropertyFieldName(@Nonnull String name)
      Called by the VDM generator to convert the name and the label of an OData navigation property into a suitable Java member variable name. These are the members of VDM entity classes that hold references to other VDM entities (as defined by navigation properties in the metadata file).
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a NavigationProperty tag, which is within an EntityType tag.
      Returns:
      A suitable Java member variable name that the VDM generator will use to create a member variable in the newly generated VDM entity class.
    • generateJavaNavigationPropertyConstantName

      @Nonnull String generateJavaNavigationPropertyConstantName(@Nonnull String name)
      Called by the VDM generator to convert the name and the label of an OData navigation property into a suitable Java constant (public static final) name. These constants are the fluent helper fields and they end up in the newly generated VDM entity classes.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a NavigationProperty tag, which is within an EntityType tag.
      Returns:
      A suitable Java constant name that the VDM generator will use to create a constant in the newly generated VDM entity class.
    • generateJavaMethodName

      @Nonnull String generateJavaMethodName(@Nonnull String name)
      Called by the VDM generator to convert the name and the label of an OData navigation property into a partial Java method name. The generator uses the result to create the following methods in the VDM entity class for accessing an OData navigation property:
      • Retrieval methods - fetch...(), get...OrNull(), get...OrFetch()
      • Modification methods - set...(), add...()
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a NavigationProperty tag, which is within an EntityType tag.
      Returns:
      A suitable Java method name that the VDM generator will use to create methods in the newly generated VDM entity class.
    • generateJavaBuilderMethodName

      @Nonnull String generateJavaBuilderMethodName(@Nonnull String name)
      Called by the VDM generator to convert the name and the label of an OData navigation property into a Lombok builder method name. The generator uses the result to augment the Lombok builder of a VDM entity class with methods to populate references to other VDM entities (navigation properties). For builder methods, a different naming convention should be used that is consistent with the Lombok builder pattern.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a NavigationProperty tag, which is within an EntityType tag.
      Returns:
      A suitable Java method name that the VDM generator will use to create a method in the builder inner class of newly generated VDM entity classes.
      See Also:
    • generateJavaOperationMethodName

      @Nonnull String generateJavaOperationMethodName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the name and the label of an OData operation (e.g. (un-)bound actions or functions) into a suitable Java method name. The generator uses the result to create a method in the associated service class which calls the OData operation.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of an operation (e.g. FunctionImport inside the EntityContainer tag).
      label - Provided by the VDM generator. In the metadata file, it reads the sap:label attribute value of an operation (e.g. FunctionImport inside the EntityContainer tag).
      Returns:
      A suitable Java method name that the VDM generator will use to create a method in the newly generated VDM service class.
    • generateJavaMethodParameterName

      @Nonnull String generateJavaMethodParameterName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the name and the label of an OData operation (e.g. (un-)bound actions or functions) parameter into a suitable Java variable (method parameter) name. The generator uses the result to populate the method it created for the function import with the parameter.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of a Parameter tag, which is within the operation tag (e.g. FunctionImport inside the EntityContainer tag).
      label - Provided by the VDM generator. In the metadata file, it reads the sap:label attribute value of a Parameter tag, which is within the operation tag (e.g. FunctionImport inside the EntityContainer tag).
      Returns:
      A suitable Java variable name that the VDM generator will use to populate the function import method with parameters.
    • generateJavaFluentHelperClassName

      @Nonnull String generateJavaFluentHelperClassName(@Nonnull String name, @Nullable String label)
      Called by the VDM generator to convert the name and the label of an OData operation (e.g. (un-)bound actions or functions) into a suitable Java class name. The generator uses the result to create a fluent helper class for calling an OData function import. This fluent helper is returned by the function import method in the associated VDM service class.
      Parameters:
      name - Provided by the VDM generator. In the metadata file, it reads the Name attribute value of an operation (e.g. FunctionImport inside the EntityContainer tag).
      label - Provided by the VDM generator. In the metadata file, it reads the sap:label attribute value of an operation (e.g. FunctionImport inside the EntityContainer tag).
      Returns:
      A suitable Java class name that the VDM generator will use to create a function import fluent helper class.