protected void configureLoadedClasses ( Class < ? > [ ] classes ) { initArtefactHandlers ( ) ; artefactInfo . clear ( ) ; allArtefactClasses . clear ( ) ; allArtefactClassesArray = null ; allClasses = classes ; // first load the domain classes log . debug ( "Going to inspect artefact classes." ) ; MetaClassRegistry metaClassRegistry = GroovySystem . getMetaClassRegistry ( ) ; for ( final Class < ? > theClass : classes ) { log . debug ( "Inspecting [" + theClass . getName ( ) + "]" ) ; // start fresh metaClassRegistry . removeMetaClass ( theClass ) ; if ( allArtefactClasses . contains ( theClass ) ) { continue ; } // check what kind of artefact it is and add to corrent data structure for ( ArtefactHandler artefactHandler : artefactHandlers ) { if ( artefactHandler . isArtefact ( theClass ) ) { log . debug ( "Adding artefact " + theClass + " of kind " + artefactHandler . getType ( ) ) ; GrailsClass gclass = addArtefact ( artefactHandler . getType ( ) , theClass ) ; // Also maintain set of all artefacts (!= all classes loaded) allArtefactClasses . add ( theClass ) ; // Update per-artefact cache DefaultArtefactInfo info = getArtefactInfo ( artefactHandler . getType ( ) , true ) ; info . addGrailsClass ( gclass ) ; break ; } } } refreshArtefactGrailsClassCaches ( ) ; allArtefactClassesArray = allArtefactClasses . toArray ( new Class [ allArtefactClasses . size ( ) ] ) ; // Tell all artefact handlers to init now we've worked out which classes are which artefacts for ( ArtefactHandler artefactHandler : artefactHandlers ) { initializeArtefacts ( artefactHandler ) ; } }
Configures the loaded classes within the GrailsApplication instance using the registered ArtefactHandler instances .