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 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.Returns theNameSource
used by thisNamingStrategy
.boolean
isReservedKeyword
(String name) Determines whether theproposedName
is a language reserved keyword.void
setNameSource
(NameSource nameSource) Sets theNameSource
that should be used by thisNamingStrategy
.
-
Method Details
-
getNameSource
Returns theNameSource
used by thisNamingStrategy
.- Returns:
- The used
NameSource
.
-
setNameSource
Sets theNameSource
that should be used by thisNamingStrategy
.- Parameters:
nameSource
- TheNameSource
to use.
-
isReservedKeyword
Determines whether theproposedName
is a language reserved keyword.- Parameters:
name
- String to check- Returns:
true
ifproposedName
is a reserved keyword,false
otherwise.
-
generateJavaClassName
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
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
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.
-
generateJavaMethodName
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.
- Retrieval methods -
-
generateJavaBuilderMethodName
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
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
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
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.
-