Package grails.core

Examples of grails.core.GrailsClass


        defaultUrlMappingsHolder.initialize();
        final GrailsControllerUrlMappings grailsControllerUrlMappings = new GrailsControllerUrlMappings(grailsApplication, defaultUrlMappingsHolder);
        ((ConfigurableApplicationContext)applicationContext).addApplicationListener( new ApplicationListener<ArtefactAdditionEvent>() {
            @Override
            public void onApplicationEvent(ArtefactAdditionEvent event) {
                GrailsClass artefact = event.getArtefact();
                if(artefact instanceof GrailsControllerClass) {
                    grailsControllerUrlMappings.registerController((GrailsControllerClass)artefact);
                }
            }
        });
View Full Code Here


        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);
View Full Code Here

    }

    public void testAbstractGrailsClassNoPackage() throws Exception {
        GroovyClassLoader cl = new GroovyClassLoader();
        Class<?> clazz = cl.parseClass("class TestService { }");
        GrailsClass grailsClass = new AbstractGrailsClass(clazz, "Service") {/*empty*/};
        assertEquals("TestService", clazz.getName());
        assertEquals("Test", grailsClass.getName());
        assertEquals("TestService", grailsClass.getFullName());
        assertNotNull(grailsClass.newInstance());
    }
View Full Code Here

    }

    public void testAbstractGrailsClassPackage() throws Exception {
        GroovyClassLoader cl = new GroovyClassLoader();
        Class<?> clazz = cl.parseClass("package test.casey; class TestService { }");
        GrailsClass grailsClass = new AbstractGrailsClass(clazz, "Service") {/*empty*/};
        assertEquals("test.casey.TestService", clazz.getName());
        assertEquals("Test", grailsClass.getName());
        assertEquals("test.casey.TestService", grailsClass.getFullName());
        assertNotNull(grailsClass.newInstance());
    }
View Full Code Here

    }

    public void testGrailsClassNonPublicConstructor() throws Exception {
        GroovyClassLoader cl = new GroovyClassLoader();
        Class<?> clazz = cl.parseClass("class ProtectedConstructor { protected ProtectedConstructor() {}}");
        GrailsClass grailsClass = new AbstractGrailsClass(clazz, "ProtectedConstructor") {/*empty*/};
        assertNotNull(grailsClass.newInstance());
    }
View Full Code Here

TOP

Related Classes of grails.core.GrailsClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.