Package com.github.jmkgreen.morphia.annotations

Examples of com.github.jmkgreen.morphia.annotations.Entity


    public void testInheritedClassAnnotations() {
      List<Indexes> annotations = ReflectionUtils.getAnnotations(Foobie.class, Indexes.class);
      Assert.assertEquals(2, annotations.size());
      Assert.assertTrue(ReflectionUtils.getAnnotation(Foobie.class, Indexes.class) instanceof Indexes);

        Entity foobie = ReflectionUtils.getClassEntityAnnotation(Foobie.class);
        Assert.assertTrue("Sub".equals(foobie.value()));

        Entity fooble = ReflectionUtils.getClassEntityAnnotation(Fooble.class);
        Assert.assertEquals(Mapper.IGNORED_FIELDNAME, fooble.value());
    }
View Full Code Here


    }

    @Test
    public void testSubEntity() {
        MappedClass foobieMapped = new MappedClass(Foobie.class, new DefaultMapper());
        Entity entity = foobieMapped.getEntityAnnotation();
        Assert.assertNotNull(entity);
        Assert.assertNotNull(entity.value());
        System.out.println("Foobie value: " + entity.value() + ", collection name: " + foobieMapped.getCollectionName());
        Assert.assertTrue("Sub".equals(entity.value()));
    }
View Full Code Here

    }

    @Test
    public void testEmptyEntity() {
        MappedClass foobleMapped = new MappedClass(Fooble.class, new DefaultMapper());
        Entity entity = foobleMapped.getEntityAnnotation();
        Assert.assertNotNull(entity);
        Assert.assertNotNull(entity.value());
        System.out.println("Fooble value: " + entity.value() + ", collection name: " + foobleMapped.getCollectionName());
        Assert.assertTrue(Mapper.IGNORED_FIELDNAME.equals(entity.value()));
        Assert.assertTrue(Fooble.class.getSimpleName().equals(foobleMapped.getCollectionName()));
    }
View Full Code Here

    public synchronized Morphia mapPackage(String packageName, boolean ignoreInvalidClasses) {
        try {
            for (Class c : ReflectionUtils.getClasses(packageName)) {
                try {
                    Embedded embeddedAnn = ReflectionUtils.getClassEmbeddedAnnotation(c);
                    Entity classEntityAnnotation = ReflectionUtils.getClassEntityAnnotation(c);
                    if (classEntityAnnotation != null || embeddedAnn != null) {
                        map(c);
                    }
                } catch (MappingException ex) {
                    if (!ignoreInvalidClasses) {
View Full Code Here

TOP

Related Classes of com.github.jmkgreen.morphia.annotations.Entity

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.