@Target(value=TYPE) @Retention(value=RUNTIME) public @interface PropertyStrategy
Entity to customize certain aspects of the introspection process that
determines which methods are considered as properties, and how new instances will be created.
Example:
@Entity
@PropertyStrategy(getterStyle = FLUENT)
public class Account {
...
}
This annotation can be inherited from an interface or parent class.
When neither the entity class nor any of its parent is explicitly annotated, the mapper will assume context-dependent defaults:
mutable = false and getterStyle = FLUENT. The
mapper detects this case by checking if the entity implements scala.Product.
mutable = false and getterStyle = JAVABEANS. The
mapper detects this case by checking if the entity is annotated with kotlin.Metadata, and if it has any method named component1 (both of these are
added automatically by the Kotlin compiler).
mutable = false and getterStyle = FLUENT.
The mapper detects this case by checking if the entity extends java.lang.Record.
mutable = true, getterStyle = JAVABEANS and setterStyle = JAVABEANS.
@PropertyStrategy(getterStyle = FLUENT), it will be mutable).| Modifier and Type | Optional Element and Description |
|---|---|
GetterStyle |
getterStyle
The style of getter.
|
boolean |
mutable
Whether the entity is mutable.
|
SetterStyle |
setterStyle
The style of setter.
|
public abstract GetterStyle getterStyle
GetterStyle and its constants for more explanations.public abstract SetterStyle setterStyle
SetterStyle and its constants for more explanations.
This has no effect if mutable() is false.
Copyright © 2017–2022. All rights reserved.