Package org.grails.core

Examples of org.grails.core.DefaultGrailsDomainClass


    }

    @Override
    @SuppressWarnings("rawtypes")
    public GrailsClass newArtefactClass(Class artefactClass) {
        return new DefaultGrailsDomainClass(artefactClass, defaultConstraints);
    }
View Full Code Here


                "   Long id\n"// WE NEED this even though GORM 2 doesn't, as we're not a "domain" class within grails-app
                "   Long version\n"+ // WE NEED this even though GORM 2 doesn't, as we're not a "domain" class within grails-app
                " String name\n" +
                "}");

        GrailsDomainClass domainClass = new DefaultGrailsDomainClass(groovyClass);

        Map constraints = domainClass.getConstrainedProperties();

        assertNotNull(constraints);
        assertFalse(constraints.isEmpty());
    }
View Full Code Here

                "   String text\n" +
                "}";

        GroovyClassLoader gcl = new GroovyClassLoader();

        DefaultGrailsDomainClass bookClass = new DefaultGrailsDomainClass(gcl.parseClass(bookClassSource, "Book"));

        Map constraints = bookClass.getConstrainedProperties();
        Constrained p = (Constrained)constraints.get("title");
        assertFalse("Title property should be required", p.isNullable());
        p = (Constrained)constraints.get("description");
        assertTrue("Description property should be optional", p.isNullable());
        p = (Constrained)constraints.get("author");
View Full Code Here

        Class[] classes = new Class[classSource.length];
        for (int i = 0; i < classSource.length; i++) {
            classes[i] = gcl.parseClass(classSource[i]);
        }

        DefaultGrailsDomainClass domainClass = new DefaultGrailsDomainClass(classes[classIndexToTest]);

        Map constraints = domainClass.getConstrainedProperties();

        ConstrainedProperty p = (ConstrainedProperty)constraints.get("name");
        Collection cons = p.getAppliedConstraints();

        assertEquals("Incorrect number of constraints extracted: " +constraints, constraintCount, cons.size());
View Full Code Here

                            "other(blank:false,size:5..15,nullable:false)\n" +
                            "email(email:true)\n" +
                        "}\n" +
                        "}");

        GrailsDomainClass domainClass = new DefaultGrailsDomainClass(groovyClass);

        Map constrainedProperties = domainClass.getConstrainedProperties();
        assertTrue(constrainedProperties.size() == 3);
        ConstrainedProperty loginConstraint = (ConstrainedProperty)constrainedProperties.get("login");
        Collection appliedConstraints = loginConstraint.getAppliedConstraints();
        assertTrue(appliedConstraints.size() == 3);
View Full Code Here

TOP

Related Classes of org.grails.core.DefaultGrailsDomainClass

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.