@Target(value=TYPE) @Retention(value=RUNTIME) public @interface HierarchyScanStrategy
Entity
-annotated classes
and Dao
-annotated interfaces.
In addition, properties will also be scanned for on Entity
-annotated classes.
By default, the mapper will transparently scan all parent classes and interfaces. The closer in proximity a type is to the base type, the more precedence it is given when scanning. In addition, parent classes are given precedence over interfaces.
For entities, this enables polymorphic mapping of a class hierarchy into different CQL tables or UDTs.
For DAOs, this enables sharing configuration between DAOs by implementing an interface that has annotations defining how the DAO methods should behave.
To disable scanning, set scanAncestors()
to false
.
To control the highest ancestor considered in scanning for annotations, use highestAncestor()
and includeHighestAncestor()
.
Modifier and Type | Optional Element and Description |
---|---|
Class<?> |
highestAncestor
The
Class to consider the highest ancestor, meaning the classes that this class extends
or implements will not be scanned for annotations. |
boolean |
includeHighestAncestor
Whether or not to include the specified
highestAncestor() in scanning. |
boolean |
scanAncestors
Whether or not ancestors should be scanned for properties and annotations.
|
public abstract Class<?> highestAncestor
Class
to consider the highest ancestor, meaning the classes that this class extends
or implements will not be scanned for annotations.
Note that If you have a complex hierarchy involving both parent classes and interfaces and highestAncestor specifies a class for example, all interfaces will still be included. Therefore it is recommended to avoid creating complex type hierarchies or to only do so if you expect the entire hierarchy to be scanned.
Defaults to Object
.
public abstract boolean includeHighestAncestor
highestAncestor()
in scanning.
Defaults to false.
Copyright © 2017–2020. All rights reserved.