@Target(value=TYPE) @Retention(value=RUNTIME) public @interface NamingStrategy
Entity
to indicate how CQL names will be inferred from the names in the Java
class.
This applies to:
Product
), that will be converted into a table name.
productId
), that will be converted into
column names.
Either of convention()
or customConverterClass()
must be specified, but not
both.
This annotation is optional. If it is not specified, the entity will default to NamingConvention.SNAKE_CASE_INSENSITIVE
.
Modifier and Type | Optional Element and Description |
---|---|
NamingConvention[] |
convention
Specifies a built-in naming convention.
|
Class<? extends NameConverter>[] |
customConverterClass
Specifies a custom converter implementation.
|
public abstract NamingConvention[] convention
The mapper processor will apply the conversion at compile time, and generate code that hard-codes the converted strings. In other words, this is slightly more efficient than a custom converter because no conversion happens at runtime.
This is mutually exclusive with customConverterClass()
.
Note that, for technical reasons, this is an array, but only one element is expected. If you specify more than one element, the mapper processor will generate a compile-time warning, and proceed with the first one.
public abstract Class<? extends NameConverter>[] customConverterClass
The provided class must implement NameConverter
and expose a public no-arg
constructor. The code generated by the mapper will create an instance at runtime, and invoke it
every time it generates a new request.
This is mutually exclusive with convention()
.
Note that, for technical reasons, this is an array, but only one element is expected. If you specify more than one element, the mapper processor will generate a compile-time warning, and proceed with the first one.
Copyright © 2017–2019. All rights reserved.