Search in sources :

Example 1 with InjectableGrailsClass

use of grails.core.InjectableGrailsClass in project grails-core by grails.

the class DefaultArtefactInfo method addGrailsClassInternal.

private void addGrailsClassInternal(GrailsClass artefactClass, boolean atStart) {
    grailsClassesByName = new LinkedHashMap<String, GrailsClass>(grailsClassesByName);
    classesByName = new LinkedHashMap<String, Class<?>>(classesByName);
    Class<?> actualClass = artefactClass.getClazz();
    boolean addToGrailsClasses = true;
    if (artefactClass instanceof InjectableGrailsClass) {
        addToGrailsClasses = ((InjectableGrailsClass) artefactClass).getAvailable();
    }
    if (addToGrailsClasses) {
        GrailsClass oldVersion = grailsClassesByName.put(actualClass.getName(), artefactClass);
        grailsClasses.remove(oldVersion);
    }
    classesByName.put(actualClass.getName(), actualClass);
    logicalPropertyNameToClassMap.put(artefactClass.getLogicalPropertyName(), artefactClass);
    if (!grailsClasses.contains(artefactClass)) {
        if (atStart) {
            grailsClasses.addFirst(artefactClass);
        } else {
            grailsClasses.addLast(artefactClass);
        }
    }
}
Also used : GrailsClass(grails.core.GrailsClass) InjectableGrailsClass(grails.core.InjectableGrailsClass) InjectableGrailsClass(grails.core.InjectableGrailsClass) GrailsClass(grails.core.GrailsClass) InjectableGrailsClass(grails.core.InjectableGrailsClass)

Aggregations

GrailsClass (grails.core.GrailsClass)1 InjectableGrailsClass (grails.core.InjectableGrailsClass)1