Package com.sap.cds.generator.util
Class NamesUtils
java.lang.Object
com.sap.cds.generator.util.NamesUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringargumentName(com.sap.cds.reflect.CdsElement element) Returns argument name that is derived from element namestatic StringargumentName(com.sap.cds.reflect.CdsParameter parameter) Returns argument name that is derived from parameter namestatic com.squareup.javapoet.ClassNameclassName(Configuration configuration, com.sap.cds.reflect.CdsType type) Returns Java class name for given CDS type.static com.squareup.javapoet.ClassNameclassName(com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsElement element) Returns Java class name for given CDS element as a nested class to some other class.static com.squareup.javapoet.ClassNameclassName(com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsParameter parameter) Returns Java class name for given CDS parameter as a nested class to some other class.static StringconstantName(com.sap.cds.reflect.CdsDefinition definition) Generates constant representing this definition without renaming supportstatic StringconstantName(com.sap.cds.reflect.CdsElement element) static com.squareup.javapoet.ClassNameeventContextClassName(Configuration configuration, com.sap.cds.reflect.CdsEntity boundEntity, com.sap.cds.reflect.CdsDefinition def) Returns qualified event context class name for the given CDS definition.static StringgetOnHandlerMethodName(com.sap.cds.reflect.CdsOperation operation) Returns name for default on-handler method for operationsstatic StringgetResolvedWrapperName(String qualifiedBuilderName, String classNameSuffix) static StringgetterName(com.sap.cds.reflect.CdsElement element) Returns classic getter name for an elementstatic StringgetterName(com.sap.cds.reflect.CdsParameter parameter) Returns classic getter name for a parameterbooleanisExcluded(String qualifiedName) static booleanisValidTechnicalEntity(Configuration configuration, com.sap.cds.reflect.CdsModel model, com.sap.cds.reflect.CdsEntity entity) static StringmethodName(com.sap.cds.reflect.CdsElement element) Returns method name that is derived from element namestatic StringmethodName(com.sap.cds.reflect.CdsOperation operation) Returns method name that is derived from element name, should be used only in fluent modestatic StringmethodName(com.sap.cds.reflect.CdsParameter parameter) Returns method name that is derived from parameter name, should be used only in fluent modestatic StringnormalizedConstantName(com.sap.cds.reflect.CdsEnumType.Enumeral<?> enumeral) static StringpackageName(com.sap.cds.reflect.CdsDefinition definition, String basePackage) Returns the effective package name of the givendefinition.static StringpackageName(com.sap.cds.reflect.CdsService service, String basePackage) Returns the effective package name of the givenservicedefinition.static StringqualifiedContextName(String qualifiedName, String name) static StringqualifiedWrapperBuilderName(com.sap.cds.reflect.CdsDefinition def, String classNameSuffix, boolean isWrapper) static StringrawName(com.sap.cds.reflect.CdsElement element) Returns class name that is derived from element name.static StringsetterName(com.sap.cds.reflect.CdsElement element) Returns classic setter name for an elementstatic StringsetterName(com.sap.cds.reflect.CdsParameter parameter) Returns classic setter name for a parameterstatic com.squareup.javapoet.ClassNamesuffixedClassName(Configuration configuration, com.sap.cds.reflect.CdsType type) Returns Java class name for given CDS type with a suffix.static com.squareup.javapoet.ClassNamesuffixedClassName(Configuration configuration, com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsElement element) Returns suffixed class name that is nested within the parent class for a given element.static com.squareup.javapoet.ClassNametemplateEventHandlerClassName(Configuration configuration, com.sap.cds.reflect.CdsEntity entity, com.sap.cds.reflect.CdsOperation operation) Returns the name of the template handler class for an action or functions.static com.squareup.javapoet.ClassNametemplateEventHandlerClassName(Configuration configuration, com.sap.cds.reflect.CdsOperation operation) Returns the name of the template handler class for an action or functions.static com.squareup.javapoet.ClassNametypedServiceBuilderName(Configuration configuration, com.sap.cds.reflect.CdsService service) Returns qualified typed service class name for the givenservicedefinition.static com.squareup.javapoet.ClassNametypedServiceClassName(Configuration configuration, com.sap.cds.reflect.CdsService service) Returns qualified typed service class name for the givenservicedefinition.static StringunqualifiedName(String qualifiedName) static voidwarnOnJavaKeywords(String qualifiedName)
-
Field Details
-
ITEM_TYPE_NAME
- See Also:
-
-
Constructor Details
-
NamesUtils
-
-
Method Details
-
qualifiedWrapperBuilderName
-
qualifiedContextName
-
unqualifiedName
-
warnOnJavaKeywords
-
isValidTechnicalEntity
public static boolean isValidTechnicalEntity(Configuration configuration, com.sap.cds.reflect.CdsModel model, com.sap.cds.reflect.CdsEntity entity) -
getResolvedWrapperName
-
constantName
Generates constant representing this definition without renaming support- Parameters:
definition-CdsDefinitionto be represented- Returns:
- constant name generated "as-is"
-
packageName
Returns the effective package name of the givendefinition.- Parameters:
definition- theCdsDefinitionbasePackage- the base package- Returns:
- the effective package name
-
packageName
Returns the effective package name of the givenservicedefinition.- Parameters:
service- theCdsServicebasePackage- the base package- Returns:
- the effective package name
-
className
public static com.squareup.javapoet.ClassName className(Configuration configuration, com.sap.cds.reflect.CdsType type) Returns Java class name for given CDS type. The name is always qualified with the package derived from the namespace of the type and a base package. Uses @cds.java.this.name as override mechanism.- Parameters:
configuration- the instance ofConfigurationtype- the instance ofCdsType- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
className
public static com.squareup.javapoet.ClassName className(com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsElement element) Returns Java class name for given CDS element as a nested class to some other class. This is useful only for classes that represent nested types.- Parameters:
parent-ClassNameof the parent classelement- aCdsElementthat is nested within the parent class- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
className
public static com.squareup.javapoet.ClassName className(com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsParameter parameter) Returns Java class name for given CDS parameter as a nested class to some other class. This is useful only for classes that represent nested _anonymous_ types that never renamed.- Parameters:
parent-ClassNameof the parent classparameter- aCdsParameterthat is nested within the parent class- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
suffixedClassName
public static com.squareup.javapoet.ClassName suffixedClassName(Configuration configuration, com.sap.cds.reflect.CdsType type) Returns Java class name for given CDS type with a suffix. Suffix is defined by the configuration, but is never configurable by the customer.- Parameters:
configuration- the instance ofConfigurationtype- the instance ofCdsTypethat should be suffixed- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
suffixedClassName
public static com.squareup.javapoet.ClassName suffixedClassName(Configuration configuration, com.squareup.javapoet.ClassName parent, com.sap.cds.reflect.CdsElement element) Returns suffixed class name that is nested within the parent class for a given element. E.g. Entity.ReturnType.- Parameters:
configuration- the instance ofConfigurationparent- parent class name asClassNameelement- the element that should be nested within the parent class- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
typedServiceClassName
public static com.squareup.javapoet.ClassName typedServiceClassName(Configuration configuration, com.sap.cds.reflect.CdsService service) Returns qualified typed service class name for the givenservicedefinition. NB: This is exception from standard rule- Parameters:
configuration- the generatorConfigurationservice- theservicedefinition- Returns:
- the full qualified typed service
ClassName
-
typedServiceBuilderName
public static com.squareup.javapoet.ClassName typedServiceBuilderName(Configuration configuration, com.sap.cds.reflect.CdsService service) Returns qualified typed service class name for the givenservicedefinition.- Parameters:
service- theservicedefinition- Returns:
- the full qualified typed service
String
-
templateEventHandlerClassName
public static com.squareup.javapoet.ClassName templateEventHandlerClassName(Configuration configuration, com.sap.cds.reflect.CdsOperation operation) Returns the name of the template handler class for an action or functions. Variant for unbound operation. Uses @cds.java.name as override mechanism.- Parameters:
configuration- the instance ofConfigurationoperation- the @CdsOperation- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
templateEventHandlerClassName
public static com.squareup.javapoet.ClassName templateEventHandlerClassName(Configuration configuration, com.sap.cds.reflect.CdsEntity entity, com.sap.cds.reflect.CdsOperation operation) Returns the name of the template handler class for an action or functions. Variant for bound operation. Uses @cds.java.name as override mechanism.- Parameters:
configuration- the instance ofConfigurationentity- the bound @CdsEntityoperation- the @CdsOperation- Returns:
- instance of the
ClassNamerepresenting the Java class name
-
getOnHandlerMethodName
Returns name for default on-handler method for operations- Parameters:
operation- the instance of @CdsOperation- Returns:
- name
-
eventContextClassName
public static com.squareup.javapoet.ClassName eventContextClassName(Configuration configuration, com.sap.cds.reflect.CdsEntity boundEntity, com.sap.cds.reflect.CdsDefinition def) Returns qualified event context class name for the given CDS definition.- Parameters:
configuration- the generatorConfigurationboundEntity- an optionally boundentitydef- theCdsType- Returns:
- the full qualified event context
ClassName
-
methodName
Returns method name that is derived from element name- Parameters:
element- the @CdsElement- Returns:
- the name
-
rawName
Returns class name that is derived from element name. This exists for compatibility reasons and does not apply transformation- Parameters:
element- the @CdsElement- Returns:
- the name
-
methodName
Returns method name that is derived from parameter name, should be used only in fluent mode- Parameters:
parameter- the @CdsParameter- Returns:
- the name
-
methodName
Returns method name that is derived from element name, should be used only in fluent mode- Parameters:
operation- the @CdsOperation- Returns:
- the name
-
setterName
Returns classic setter name for an element- Parameters:
element- theCdsElement- Returns:
- name
-
getterName
Returns classic getter name for an element- Parameters:
element- theCdsElement- Returns:
- name
-
setterName
Returns classic setter name for a parameter- Parameters:
parameter- theCdsParameter- Returns:
- name
-
getterName
Returns classic getter name for a parameter- Parameters:
parameter- theCdsParameter- Returns:
- name
-
argumentName
Returns argument name that is derived from element name- Parameters:
element- the @CdsElement- Returns:
- the name
-
argumentName
Returns argument name that is derived from parameter name- Parameters:
parameter- the @CdsElement- Returns:
- the name
-
constantName
-
normalizedConstantName
-
isExcluded
-