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
Represents a
NamingStrategy
, which removes pre- and suffixes from the generated Java identifiers that are
typically used in S4Hana service definitions.-
Constructor Summary
ConstructorDescriptionS4HanaNamingStrategy
(NameSource nameSource) Constructs a newS4HanaNamingStrategy
instance. -
Method Summary
Modifier and TypeMethodDescriptionCalled by the VDM generator to convert the name and the label of an OData navigation property into a Lombok builder method name.generateJavaClassName
(String name, 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.generateJavaConstantName
(String name, 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.generateJavaFieldName
(String name, 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.generateJavaFluentHelperClassName
(String name, String label) Called by the VDM generator to convert the name and the label of an OData operation (e.g.generateJavaMethodName
(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.generateJavaMethodParameterName
(String name, String label) Called by the VDM generator to convert the name and the label of an OData operation (e.g.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.Called by the VDM generator to convert the name and the label of an OData navigation property into a suitable Java member variable name.generateJavaOperationMethodName
(String name, String label) Called by the VDM generator to convert the name and the label of an OData operation (e.g.Methods inherited from class com.sap.cloud.sdk.datamodel.odata.utility.AbstractNamingStrategy
appendSuffixIfNameIsReservedKeyword, chooseBetweenNameAndLabel, convertToJavaClassName, convertToJavaConstantName, convertToJavaFieldName, convertToJavaMethodName, finishJavaBuilderMethodNameGeneration, finishJavaClassNameGeneration, finishJavaConstantNameGeneration, finishJavaFieldNameGeneration, finishJavaFluentHelperClassNameGeneration, finishJavaMethodNameGeneration, finishJavaMethodParameterNameGeneration, finishJavaNavigationPropertyConstantNameGeneration, finishJavaNavigationPropertyFieldNameGeneration, finishJavaOperationMethodNameGeneration, fixAcronymsInConstantNames, getNameSource, isReservedKeyword, removeInvalidJavaCharacters, removeRepeatedUnderscores, removeWhiteSpaces, setNameSource, throwIfConversionResultIsNullOrEmpty, throwIfConversionResultIsReservedKeyword, uncapitalizeLeadingAcronym
-
Constructor Details
-
S4HanaNamingStrategy
Constructs a newS4HanaNamingStrategy
instance.- Parameters:
nameSource
- TheNameSource
that should be used by the newly created instance.
-
S4HanaNamingStrategy
public S4HanaNamingStrategy()
-
-
Method Details
-
generateJavaClassName
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 interfaceNamingStrategy
- Overrides:
generateJavaClassName
in classAbstractNamingStrategy
- 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
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 interfaceNamingStrategy
- Overrides:
generateJavaFieldName
in classAbstractNamingStrategy
- 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
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 interfaceNamingStrategy
- Overrides:
generateJavaConstantName
in classAbstractNamingStrategy
- 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.
-
generateJavaMethodName
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 interfaceNamingStrategy
- Overrides:
generateJavaMethodName
in classAbstractNamingStrategy
- 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.
- Retrieval methods -
-
generateJavaBuilderMethodName
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 interfaceNamingStrategy
- Overrides:
generateJavaBuilderMethodName
in classAbstractNamingStrategy
- 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 interfaceNamingStrategy
- Overrides:
generateJavaOperationMethodName
in classAbstractNamingStrategy
- 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 interfaceNamingStrategy
- Overrides:
generateJavaMethodParameterName
in classAbstractNamingStrategy
- 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 interfaceNamingStrategy
- Overrides:
generateJavaFluentHelperClassName
in classAbstractNamingStrategy
- 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.
-