Class S4HanaNamingStrategy

java.lang.Object
com.sap.cloud.sdk.datamodel.odata.utility.AbstractNamingStrategy
com.sap.cloud.sdk.datamodel.odata.utility.S4HanaNamingStrategy
All Implemented Interfaces:
NamingStrategy

public final class S4HanaNamingStrategy extends AbstractNamingStrategy
Represents a NamingStrategy, which removes pre- and suffixes from the generated Java identifiers that are typically used in S4Hana service definitions.
  • Constructor Details

    • S4HanaNamingStrategy

      public S4HanaNamingStrategy(@Nonnull NameSource nameSource)
      Constructs a new S4HanaNamingStrategy instance.
      Parameters:
      nameSource - The NameSource that should be used by the newly created instance.
    • S4HanaNamingStrategy

      public S4HanaNamingStrategy()
  • Method Details

    • generateJavaClassName

      @Nonnull public String generateJavaClassName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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)
      Specified by:
      generateJavaClassName in interface NamingStrategy
      Overrides:
      generateJavaClassName in class AbstractNamingStrategy
      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 public String generateJavaFieldName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaFieldName in interface NamingStrategy
      Overrides:
      generateJavaFieldName in class AbstractNamingStrategy
      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 public String generateJavaConstantName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaConstantName in interface NamingStrategy
      Overrides:
      generateJavaConstantName in class AbstractNamingStrategy
      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 public String generateJavaNavigationPropertyFieldName(@Nonnull String name)
      Description copied from interface: NamingStrategy
      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).
      Specified by:
      generateJavaNavigationPropertyFieldName in interface NamingStrategy
      Overrides:
      generateJavaNavigationPropertyFieldName in class AbstractNamingStrategy
      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 public String generateJavaNavigationPropertyConstantName(@Nonnull String name)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaNavigationPropertyConstantName in interface NamingStrategy
      Overrides:
      generateJavaNavigationPropertyConstantName in class AbstractNamingStrategy
      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 public String generateJavaMethodName(@Nonnull String name)
      Description copied from interface: NamingStrategy
      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...()
      Specified by:
      generateJavaMethodName in interface NamingStrategy
      Overrides:
      generateJavaMethodName in class AbstractNamingStrategy
      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 public String generateJavaBuilderMethodName(@Nonnull String name)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaBuilderMethodName in interface NamingStrategy
      Overrides:
      generateJavaBuilderMethodName in class AbstractNamingStrategy
      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 public String generateJavaOperationMethodName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaOperationMethodName in interface NamingStrategy
      Overrides:
      generateJavaOperationMethodName in class AbstractNamingStrategy
      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 public String generateJavaMethodParameterName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaMethodParameterName in interface NamingStrategy
      Overrides:
      generateJavaMethodParameterName in class AbstractNamingStrategy
      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 public String generateJavaFluentHelperClassName(@Nonnull String name, @Nullable String label)
      Description copied from interface: NamingStrategy
      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.
      Specified by:
      generateJavaFluentHelperClassName in interface NamingStrategy
      Overrides:
      generateJavaFluentHelperClassName in class AbstractNamingStrategy
      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.