Class CassandraEntityClassScanner
java.lang.Object
org.springframework.data.cassandra.config.CassandraEntityClassScanner
Scans packages for Cassandra entities. The entity scanner scans for entity classes annotated with
entity annotations
on the class path using either base package names, base package
classes or both.- Author:
- Matthew T. Adams, Mark Paluch
- See Also:
-
ClassUtils.forName(String, ClassLoader)
-
Constructor Summary
ConstructorDescriptionCreates a newCassandraEntityClassScanner
.CassandraEntityClassScanner
(Class<?>... entityBasePackageClasses) Creates a newCassandraEntityClassScanner
givenentityBasePackageClasses
.CassandraEntityClassScanner
(String... entityBasePackages) Creates a newCassandraEntityClassScanner
givenentityBasePackages
.CassandraEntityClassScanner
(Collection<String> entityBasePackages) Creates a newCassandraEntityClassScanner
givenentityBasePackages
.CassandraEntityClassScanner
(Collection<String> entityBasePackages, Collection<Class<?>> entityBasePackageClasses) -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends Annotation>[]
Scan one or more base packages for entity classes.Scan one or more base packages for entity classes.scan
(Collection<String> entityBasePackages) Scan one or more base packages for entity classes.scan
(Collection<String> entityBasePackages, Collection<Class<?>> entityBasePackageClasses) Scan one or more base packages for entity classes.Scans the mapping base package for entity classes annotated withTable
orPrimaryKeyClass
.void
setBeanClassLoader
(ClassLoader beanClassLoader) Set the beanClassLoader
to load class candidates discovered by the class path scan.void
setEntityBasePackageClasses
(Collection<Class<?>> entityBasePackageClasses) Set the base package classes to be used for the entity scan.void
setEntityBasePackages
(Collection<String> entityBasePackages) Set the base package names to be used for the entity scan.
-
Constructor Details
-
CassandraEntityClassScanner
public CassandraEntityClassScanner()Creates a newCassandraEntityClassScanner
. -
CassandraEntityClassScanner
Creates a newCassandraEntityClassScanner
givenentityBasePackageClasses
.- Parameters:
entityBasePackageClasses
- must not be null.
-
CassandraEntityClassScanner
Creates a newCassandraEntityClassScanner
givenentityBasePackages
.- Parameters:
entityBasePackages
- must not be null.
-
CassandraEntityClassScanner
Creates a newCassandraEntityClassScanner
givenentityBasePackages
.- Parameters:
entityBasePackages
- must not be null.
-
CassandraEntityClassScanner
public CassandraEntityClassScanner(Collection<String> entityBasePackages, Collection<Class<?>> entityBasePackageClasses) - Parameters:
entityBasePackages
- must not be null.entityBasePackageClasses
- must not be null.
-
-
Method Details
-
scan
Scan one or more base packages for entity classes. Classes are loaded using the current class loader.- Parameters:
entityBasePackages
- must not be null.- Returns:
Set
containing all discovered entity classes.- Throws:
ClassNotFoundException
-
scan
public static Set<Class<?>> scan(Class<?>... entityBasePackageClasses) throws ClassNotFoundException Scan one or more base packages for entity classes. Classes are loaded using the current class loader.- Parameters:
entityBasePackageClasses
- must not be null.- Returns:
Set
containing all discovered entity classes.- Throws:
ClassNotFoundException
- if a discovered class could not be loaded via.
-
scan
public static Set<Class<?>> scan(Collection<String> entityBasePackages) throws ClassNotFoundException Scan one or more base packages for entity classes. Classes are loaded using the current class loader.- Parameters:
entityBasePackages
- must not be null.- Returns:
Set
containing all discovered entity classes.- Throws:
ClassNotFoundException
- if a discovered class could not be loaded via.
-
scan
public static Set<Class<?>> scan(Collection<String> entityBasePackages, Collection<Class<?>> entityBasePackageClasses) throws ClassNotFoundException Scan one or more base packages for entity classes. Classes are loaded using the current class loader.- Parameters:
entityBasePackages
- must not be null.entityBasePackageClasses
- must not be null.- Returns:
Set
containing all discovered entity classes.- Throws:
ClassNotFoundException
- if a discovered class could not be loaded via.
-
getEntityBasePackages
- Returns:
- base package names used for the entity scan.
-
setEntityBasePackages
Set the base package names to be used for the entity scan.- Parameters:
entityBasePackages
- must not be null.
-
getEntityBasePackageClasses
- Returns:
- base package classes used for the entity scan.
-
setEntityBasePackageClasses
Set the base package classes to be used for the entity scan.- Parameters:
entityBasePackageClasses
- must not be null.
-
setBeanClassLoader
Set the beanClassLoader
to load class candidates discovered by the class path scan.- Parameters:
beanClassLoader
-
-
scanForEntityClasses
Scans the mapping base package for entity classes annotated withTable
orPrimaryKeyClass
.- Returns:
Set
representing the annotated entity classes found.- See Also:
-
getEntityAnnotations
- Returns:
- entity annotations.
- See Also:
-