public synchronized Morphia mapPackage ( final String packageName , final boolean ignoreInvalidClasses ) { try { for ( final Class clazz : ReflectionUtils . getClasses ( getClass ( ) . getClassLoader ( ) , packageName , mapper . getOptions ( ) . isMapSubPackages ( ) ) ) { try { final Embedded embeddedAnn = ReflectionUtils . getClassEmbeddedAnnotation ( clazz ) ; final Entity entityAnn = ReflectionUtils . getClassEntityAnnotation ( clazz ) ; final boolean isAbstract = Modifier . isAbstract ( clazz . getModifiers ( ) ) ; if ( ( entityAnn != null || embeddedAnn != null ) && ! isAbstract ) { map ( clazz ) ; } } catch ( final MappingException ex ) { if ( ! ignoreInvalidClasses ) { throw ex ; } } } return this ; } catch ( IOException e ) { throw new MappingException ( "Could not get map classes from package " + packageName , e ) ; } catch ( ClassNotFoundException e ) { throw new MappingException ( "Could not get map classes from package " + packageName , e ) ; } }
Tries to map all classes in the package specified .