Search in sources :

Example 1 with ReflectionScan

use of com.robo4j.core.reflect.ReflectionScan in project robo4j by Robo4J.

the class PersistenceDescriptorFactory method scanForEntities.

private List<String> scanForEntities(ClassLoader loader, String... entityPackages) {
    ReflectionScan scan = new ReflectionScan(loader);
    List<String> classesNames = processClassesWithAnnotation(loader, scan.scanForEntities(entityPackages));
    registeredClasses = classesNames.stream().map(cn -> {
        try {
            return RoboClassLoader.getInstance().getClassLoader().loadClass(cn);
        } catch (ClassNotFoundException e) {
            SimpleLoggingUtil.error(getClass(), "failed to load class: ", e);
            return null;
        }
    }).filter(Objects::nonNull).collect(Collectors.toList());
    return classesNames;
}
Also used : Objects(java.util.Objects) Entity(javax.persistence.Entity) List(java.util.List) Properties(java.util.Properties) RoboClassLoader(com.robo4j.core.client.util.RoboClassLoader) SimpleLoggingUtil(com.robo4j.core.logging.SimpleLoggingUtil) PersistenceUnitInfo(javax.persistence.spi.PersistenceUnitInfo) ReflectionScan(com.robo4j.core.reflect.ReflectionScan) DataSourceType(com.robo4j.db.sql.support.DataSourceType) RoboDbException(com.robo4j.db.sql.RoboDbException) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) ReflectionScan(com.robo4j.core.reflect.ReflectionScan)

Example 2 with ReflectionScan

use of com.robo4j.core.reflect.ReflectionScan in project robo4j by Robo4J.

the class HttpCodecRegistry method scan.

public void scan(ClassLoader loader, String... packages) {
    ReflectionScan scan = new ReflectionScan(loader);
    processClasses(loader, scan.scanForEntities(packages));
}
Also used : ReflectionScan(com.robo4j.core.reflect.ReflectionScan)

Aggregations

ReflectionScan (com.robo4j.core.reflect.ReflectionScan)2 RoboClassLoader (com.robo4j.core.client.util.RoboClassLoader)1 SimpleLoggingUtil (com.robo4j.core.logging.SimpleLoggingUtil)1 RoboDbException (com.robo4j.db.sql.RoboDbException)1 DataSourceType (com.robo4j.db.sql.support.DataSourceType)1 List (java.util.List)1 Objects (java.util.Objects)1 Properties (java.util.Properties)1 Collectors (java.util.stream.Collectors)1 Entity (javax.persistence.Entity)1 PersistenceUnitInfo (javax.persistence.spi.PersistenceUnitInfo)1