Class CassandraEntityClassScanner

java.lang.Object
org.springframework.data.cassandra.config.CassandraEntityClassScanner

public class CassandraEntityClassScanner extends Object
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 Details

    • CassandraEntityClassScanner

      public CassandraEntityClassScanner()
    • CassandraEntityClassScanner

      public CassandraEntityClassScanner(Class<?>... entityBasePackageClasses)
      Creates a new CassandraEntityClassScanner given entityBasePackageClasses.
      Parameters:
      entityBasePackageClasses - must not be null.
    • CassandraEntityClassScanner

      public CassandraEntityClassScanner(String... entityBasePackages)
      Creates a new CassandraEntityClassScanner given entityBasePackages.
      Parameters:
      entityBasePackages - must not be null.
    • CassandraEntityClassScanner

      public CassandraEntityClassScanner(Collection<String> entityBasePackages)
      Creates a new CassandraEntityClassScanner given entityBasePackages.
      Parameters:
      entityBasePackages - must not be null.
    • CassandraEntityClassScanner

      public CassandraEntityClassScanner(Collection<String> entityBasePackages, Collection<Class<?>> entityBasePackageClasses)
      Creates a new CassandraEntityClassScanner given entityBasePackages and entityBasePackageClasses.
      Parameters:
      entityBasePackages - must not be null.
      entityBasePackageClasses - must not be null.
  • Method Details

    • scan

      public static Set<Class<?>> scan(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
    • 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

      public Set<String> getEntityBasePackages()
      Returns:
      base package names used for the entity scan.
    • setEntityBasePackages

      public void setEntityBasePackages(Collection<String> entityBasePackages)
      Set the base package names to be used for the entity scan.
      Parameters:
      entityBasePackages - must not be null.
    • getEntityBasePackageClasses

      public Set<Class<?>> getEntityBasePackageClasses()
      Returns:
      base package classes used for the entity scan.
    • setEntityBasePackageClasses

      public void setEntityBasePackageClasses(Collection<Class<?>> entityBasePackageClasses)
      Set the base package classes to be used for the entity scan.
      Parameters:
      entityBasePackageClasses - must not be null.
    • setBeanClassLoader

      public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader)
      Set the bean ClassLoader to load class candidates discovered by the class path scan.
      Parameters:
      beanClassLoader -
    • scanForEntityClasses

      public Set<Class<?>> scanForEntityClasses()
      Scans the mapping base package for entity classes annotated with Table or PrimaryKeyClass.
      Returns:
      Set representing the annotated entity classes found.
      See Also:
    • getEntityAnnotations

      protected Class<? extends Annotation>[] getEntityAnnotations()
      Returns:
      entity annotations.
      See Also: