@Beta public class DefaultNamingStrategy extends Object implements NamingStrategy
NamingStrategy
interface, adjusting the nameSource for S4HANA services.
This implementation basically removes some predefined prefixes from the name (see
getEntityNamePrefixesToRemove()
and getPropertyNamePrefixesToRemove()
), inner spaces from labels,
and invalid characters from names and labels.
Modifier and Type | Class and Description |
---|---|
static class |
DefaultNamingStrategy.NameSource
An enum representing the logic to be used by the
DefaultNamingStrategy for determining the source for the
java namings. |
Constructor and Description |
---|
DefaultNamingStrategy() |
Modifier and Type | Method and Description |
---|---|
protected Collection<String> |
getEntityNamePrefixesToRemove()
Getter for the (immutable) collection of all prefixes that should be stripped off of entity names.
|
String |
getNameFromEntity(String entityName,
String entityLabel)
Converts the given name and label of an edm entity into a java name.
|
String |
getNameFromProperty(String propertyName,
String propertyLabel)
Converts the given name and label of an edm property into a java name.
|
protected Collection<String> |
getPropertyNamePrefixesToRemove()
Getter for the (immutable) collection of all prefixes that should be stripped off of property names.
|
@Nonnull public String getNameFromEntity(@Nonnull String entityName, @Nullable String entityLabel)
NamingStrategy
This method can be used to remove unwanted pre-/suffixes or map the name completely new.
The actual creation of java-style names (class, variable, constants etc.) is done later, based on the name returned by this method.
For best results, the name returned should be given in CamelCase.
getNameFromEntity
in interface NamingStrategy
entityName
- The entity name, taken from the metadata file.entityLabel
- The entity label, taken from the metadata file.@Nonnull public String getNameFromProperty(@Nonnull String propertyName, @Nullable String propertyLabel)
NamingStrategy
This method can be used to remove unwanted pre-/suffixes or map the name completely new.
The actual creation of java-style names (class, variable, constants etc.) is done later, based on the name returned by this method.
For best results, the name returned should be given in CamelCase.
getNameFromProperty
in interface NamingStrategy
propertyName
- The property name, taken from the metadata files.propertyLabel
- The property label, taken from the metadata file.protected Collection<String> getEntityNamePrefixesToRemove()
In this default implementation only one prefix will be removed.
protected Collection<String> getPropertyNamePrefixesToRemove()
In this default implementation only one prefix will be removed.
Copyright © 2020 SAP SE. All rights reserved.