java类javax.persistence.MappedSuperclass的实例源码

JpaResourceInformationProvider.java 文件源码 项目:crnk-framework 阅读 34 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public ResourceInformation build(final Class<?> resourceClass) {
    String resourceType = getResourceType(resourceClass);


    MetaDataObject meta = metaProvider.discoverMeta(resourceClass).asDataObject();
    DefaultResourceInstanceBuilder instanceBuilder = new DefaultResourceInstanceBuilder(resourceClass);

    List<ResourceField> fields = getResourceFields(resourceClass);

    Class<?> superclass = resourceClass.getSuperclass();
    String superResourceType = superclass != Object.class
            && superclass.getAnnotation(MappedSuperclass.class) == null ? context.getResourceType(superclass)
            : null;

    TypeParser typeParser = context.getTypeParser();
    return new JpaResourceInformation(typeParser, meta, resourceClass, resourceType, superResourceType,
            instanceBuilder, fields);
}
JpaResourceInformationProvider.java 文件源码 项目:crnk-framework 阅读 35 收藏 0 点赞 0 评论 0
@Override
public String getResourceType(Class<?> entityClass) {
    JpaResource annotation = entityClass.getAnnotation(JpaResource.class);
    if (annotation != null) {
        return annotation.type();
    }
    if (entityClass.getAnnotation(MappedSuperclass.class) != null) {
        return null; // super classes do not have a document type
    }

    String name = entityClass.getSimpleName();
    if (name.endsWith(ENTITY_NAME_SUFFIX)) {
        name = name.substring(0, name.length() - ENTITY_NAME_SUFFIX.length());
    }
    return Character.toLowerCase(name.charAt(0)) + name.substring(1);
}
AbstractPropertyHolder.java 文件源码 项目:lams 阅读 36 收藏 0 点赞 0 评论 0
private void buildHierarchyColumnOverride(XClass element) {
    XClass current = element;
    Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
    Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>();
    Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>();
    while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) {
        if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class )
                || current.isAnnotationPresent( Embeddable.class ) ) {
            //FIXME is embeddable override?
            Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() );
            Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() );
            Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() );
            currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses
            currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
            currentJoinTableOverride.putAll( joinTableOverride ); //subclasses have precedence over superclasses
            columnOverride = currentOverride;
            joinColumnOverride = currentJoinOverride;
            joinTableOverride = currentJoinTableOverride;
        }
        current = current.getSuperclass();
    }

    holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null;
    holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null;
    holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null;
}
CubaClientTestCase.java 文件源码 项目:cuba 阅读 28 收藏 0 点赞 0 评论 0
protected List<String> getClasses(Resource[] resources) {
    List<String> classNames = new ArrayList<>();

    for (Resource resource : resources) {
        if (resource.isReadable()) {
            MetadataReader metadataReader;
            try {
                metadataReader = metadataReaderFactory.getMetadataReader(resource);
            } catch (IOException e) {
                throw new RuntimeException("Unable to read metadata resource", e);
            }

            AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
            if (annotationMetadata.isAnnotated(com.haulmont.chile.core.annotations.MetaClass.class.getName())
                    || annotationMetadata.isAnnotated(MappedSuperclass.class.getName())
                    || annotationMetadata.isAnnotated(Entity.class.getName())) {
                ClassMetadata classMetadata = metadataReader.getClassMetadata();
                classNames.add(classMetadata.getClassName());
            }
        }
    }
    return classNames;
}
EntityClass.java 文件源码 项目:org.fastnate 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Fills the {@link #properties}.
 *
 * @param c
 *            the currently inspected class
 * @param stopClass
 *            the class in the hierarchy to stop inspecting
 */
private void buildProperties(final Class<? super E> c, final Class<? super E> stopClass) {
    // Fill properties of super classes (at least until we find the joined parent class)
    if (c.getSuperclass() != null && c.getSuperclass() != stopClass) {
        buildProperties(c.getSuperclass(), stopClass);
    }

    // And now fill the properties of this class
    if (c.isAnnotationPresent(MappedSuperclass.class) || c.isAnnotationPresent(Entity.class)) {
        for (final AttributeAccessor field : this.accessStyle.getDeclaredAttributes(c, this.entityClass)) {
            if (!field.isAnnotationPresent(EmbeddedId.class) && !field.isAnnotationPresent(Id.class)) {
                final Property<E, ?> property = buildProperty(field, getColumnAnnotation(field),
                        this.associationOverrides.get(field.getName()));
                if (property != null) {
                    this.properties.put(field.getName(), property);
                    this.allProperties.add(property);
                    if (property instanceof SingularProperty) {
                        buildUniqueProperty((SingularProperty<E, ?>) property);
                    }
                }
            }
        }
    }

}
StaticWeavingTest.java 文件源码 项目:rice 阅读 30 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(
            DocumentAttachment.class.getPackage().getName(),
            DocumentBase.class.getPackage().getName(),
            MaintenanceLock.class.getPackage().getName(),
            Message.class.getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
EntityTools.java 文件源码 项目:xcrud 阅读 25 收藏 0 点赞 0 评论 0
/**
 * A partir du nom du fieldname, retorune le field
 * @param cl
 * @param fieldName
 * @return
 * @throws FieldNotFound 
 */
private static Field getField(final Class cl, final String fieldName) throws FieldNotFound {
    Class tClass = cl;
    boolean found = false;
    while (!found && (tClass.isAnnotationPresent(Entity.class) || tClass.isAnnotationPresent(MappedSuperclass.class))) {
        try {
            Field field = tClass.getDeclaredField(fieldName);
            if (field.isAnnotationPresent(Lob.class)) {
                throw new FieldNotFound();
            }
            return field;
        } catch (NoSuchFieldException ex) { // on verifie dans la hierarchie aussi
            tClass = tClass.getSuperclass();
        }
    }
    throw new FieldNotFound();
}
OrmUtils.java 文件源码 项目:kuali_rice 阅读 30 收藏 0 点赞 0 评论 0
public static boolean isJpaAnnotated(Class<?> clazz) {
    if (clazz == null) {
        return false;
    }
    if (!cache.containsKey(clazz.getName())) {
        if (clazz.getName().contains("EnhancerByCGLIB")) {
            try {
                // Strip a proxy if found
                clazz = Class.forName(clazz.getName().substring(0, clazz.getName().indexOf("$$EnhancerByCGLIB")));
            } catch (Exception e) {
                LOG.error(e.getMessage(), e);
            }
        }
        synchronized (cache) {
            cache.put(clazz.getName(), new Boolean(clazz.isAnnotationPresent(Entity.class) || clazz.isAnnotationPresent(MappedSuperclass.class)));
}
    }
    return cache.get(clazz.getName()).booleanValue();
 }
JandexAssert.java 文件源码 项目:units4j 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Verifies that all class that are annotated with {@link Entity} observe the rules for JPA entities.
 * 
 * <ul>
 * <li>The class must have a public or protected, no-argument constructor. The class may have other
 * constructors.</li>
 * <li>The class must not be declared final.</li>
 * <li>No methods or persistent instance variables must be declared final.</li>
 * <li>Persistent instance variables must be declared private, protected, or package-private.</li>
 * </ul>
 * 
 * @return Self.
 */
public JandexAssert hasOnlyValidJpaEntities() {
    // Precondition
    isNotNull();

    final List<AnnotationInstance> annotations = new ArrayList<>();
    annotations.addAll(actual.getAnnotations(DotName.createSimple(Entity.class.getName())));
    annotations.addAll(actual.getAnnotations(DotName.createSimple(MappedSuperclass.class.getName())));
    for (final AnnotationInstance ai : annotations) {
        final AnnotationTarget target = ai.target();
        final ClassInfo info = target.asClass();
        final AssertionRules<ClassInfo> rules = new AssertionRules<ClassInfo>(
                new RulePublicOrProtectedNoArgConstructor(), new RuleClassNotFinal(),
                new RuleClassHasNoFinalMethods(), new RulePersistentInstanceFieldVisibility());
        final AssertionResult result = rules.verify(info);
        if (!result.isValid()) {
            failWithMessage(result.getErrorMessage());
        }
    }

    return this;

}
InheritanceState.java 文件源码 项目:lams 阅读 35 收藏 0 点赞 0 评论 0
private void extractInheritanceType() {
    XAnnotatedElement element = getClazz();
    Inheritance inhAnn = element.getAnnotation( Inheritance.class );
    MappedSuperclass mappedSuperClass = element.getAnnotation( MappedSuperclass.class );
    if ( mappedSuperClass != null ) {
        setEmbeddableSuperclass( true );
        setType( inhAnn == null ? null : inhAnn.strategy() );
    }
    else {
        setType( inhAnn == null ? InheritanceType.SINGLE_TABLE : inhAnn.strategy() );
    }
}
InheritanceState.java 文件源码 项目:lams 阅读 32 收藏 0 点赞 0 评论 0
private void addMappedSuperClassInMetadata(PersistentClass persistentClass) {
    //add @MappedSuperclass in the metadata
    // classes from 0 to n-1 are @MappedSuperclass and should be linked
    org.hibernate.mapping.MappedSuperclass mappedSuperclass = null;
    final InheritanceState superEntityState =
            InheritanceState.getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass );
    PersistentClass superEntity =
            superEntityState != null ?
                    mappings.getClass( superEntityState.getClazz().getName() ) :
                    null;
    final int lastMappedSuperclass = classesToProcessForMappedSuperclass.size() - 1;
    for ( int index = 0; index < lastMappedSuperclass; index++ ) {
        org.hibernate.mapping.MappedSuperclass parentSuperclass = mappedSuperclass;
        final Class<?> type = mappings.getReflectionManager()
                .toClass( classesToProcessForMappedSuperclass.get( index ) );
        //add MAppedSuperclass if not already there
        mappedSuperclass = mappings.getMappedSuperclass( type );
        if ( mappedSuperclass == null ) {
            mappedSuperclass = new org.hibernate.mapping.MappedSuperclass( parentSuperclass, superEntity );
            mappedSuperclass.setMappedClass( type );
            mappings.addMappedSuperclass( type, mappedSuperclass );
        }
    }
    if ( mappedSuperclass != null ) {
        persistentClass.setSuperMappedSuperclass( mappedSuperclass );
    }
}
JPAOverriddenAnnotationReader.java 文件源码 项目:lams 阅读 38 收藏 0 点赞 0 评论 0
private MappedSuperclass getMappedSuperclass(Element tree, XMLContext.Default defaults) {
    if ( tree == null ) {
        return defaults.canUseJavaAnnotations() ? getPhysicalAnnotation( MappedSuperclass.class ) : null;
    }
    else {
        if ( "mapped-superclass".equals( tree.getName() ) ) {
            AnnotationDescriptor entity = new AnnotationDescriptor( MappedSuperclass.class );
            return AnnotationFactory.create( entity );
        }
        else {
            return null; //this is not an entity
        }
    }
}
ClassInventory.java 文件源码 项目:oma-riista-web 阅读 25 收藏 0 点赞 0 评论 0
@Nonnull
@SuppressWarnings("unchecked")
public static Set<Class<?>> getManagedJpaClasses() {
    return getMainClasses(Predicates.or(
            withAnnotation(Entity.class),
            withAnnotation(Embeddable.class),
            withAnnotation(MappedSuperclass.class)));
}
AbstractEntityMetaProvider.java 文件源码 项目:katharsis-framework 阅读 34 收藏 0 点赞 0 评论 0
private Class<?> getJpaSuperclass(Class<?> resourceClass) {
    Class<?> superclass = resourceClass.getSuperclass();
    while(superclass != Object.class){
        if(superclass.getAnnotation(Entity.class) != null || superclass.getAnnotation(MappedSuperclass.class) != null){
            return superclass;
        }
        superclass = superclass.getSuperclass();
    }
    return null;
}
MetaClassRepresentation.java 文件源码 项目:cuba 阅读 35 收藏 0 点赞 0 评论 0
public String getParent() {
    MetaClass ancestor = meta.getAncestor();

    if (ancestor == null || !ancestor.getName().contains("$") ||
            ancestor.getJavaClass().isAnnotationPresent(MappedSuperclass.class))
        return "";

    if (!readPermitted(ancestor)) {
        return null;
    }

    return "Parent is " + asHref(ancestor.getName());
}
QueryCacheManager.java 文件源码 项目:cuba 阅读 25 收藏 0 点赞 0 评论 0
protected Set<String> getDescendants(Set<String> relatedTypes) {
    if (relatedTypes == null) return null;
    Set<String> newRelatedTypes = new HashSet<>();
    relatedTypes.forEach(type -> {
        newRelatedTypes.add(type);
        MetaClass metaClass = metadata.getClassNN(type);
        if (metaClass.getDescendants() != null) {
            Set<String> descendants = metaClass.getDescendants().stream()
                    .filter(it -> it.getJavaClass() != null && !it.getJavaClass().isAnnotationPresent(MappedSuperclass.class))
                    .map(MetadataObject::getName).collect(Collectors.toSet());
            newRelatedTypes.addAll(descendants);
        }
    });
    return newRelatedTypes;
}
EntityMarkerClassTransformer.java 文件源码 项目:metaworks_framework 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Determines if a given annotation set contains annotations that correspond to ones that someone would expect to appear
 * in a persistence.xml
 * 
 * @param annotations
 * @return
 */
protected boolean containsTypeLevelPersistenceAnnotation(Annotation[] annotations) {
    for (Annotation annotation : annotations) {
        if (annotation.getTypeName().equals(Entity.class.getName())
                || annotation.getTypeName().equals(Embeddable.class.getName())
                || annotation.getTypeName().equals(MappedSuperclass.class.getName())) {
            return true;
        }
    }
    return false;
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 33 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(
            DocumentAttachment.class.getPackage().getName(),
            DocumentBase.class.getPackage().getName(),
            MaintenanceLock.class.getPackage().getName(),
            Message.class.getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 27 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections("org.kuali.rice.krad");
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 27 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 34 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(
            PersistableBusinessObjectBase.class.getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 31 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 34 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 31 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections("org.kuali.rice.kew", "org.kuali.rice.kim", "org.kuali.rice.kcb", "org.kuali.rice.ken");
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 26 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
StaticWeavingTest.java 文件源码 项目:kc-rice 阅读 28 收藏 0 点赞 0 评论 0
@Test
public void testStaticWeaving() {
    // first, scan for all files on the classpath with an @Entity or @MappedSuperClass annotation
    Reflections reflections = new Reflections(getClass().getPackage().getName());
    Set<Class<?>> entityTypes = reflections.getTypesAnnotatedWith(Entity.class, true);
    Set<Class<?>> superTypes = reflections.getTypesAnnotatedWith(MappedSuperclass.class, true);
    Set<Class<?>> embeddableTypes = reflections.getTypesAnnotatedWith(Embeddable.class, true);

    // next, let's assert that they have been statically weaved
    assertStaticWeaved(entityTypes, superTypes, embeddableTypes);
}
EntityMarkerClassTransformer.java 文件源码 项目:SparkCommerce 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Determines if a given annotation set contains annotations that correspond to ones that someone would expect to appear
 * in a persistence.xml
 * 
 * @param annotations
 * @return
 */
protected boolean containsTypeLevelPersistenceAnnotation(Annotation[] annotations) {
    for (Annotation annotation : annotations) {
        if (annotation.getTypeName().equals(Entity.class.getName())
                || annotation.getTypeName().equals(Embeddable.class.getName())
                || annotation.getTypeName().equals(MappedSuperclass.class.getName())) {
            return true;
        }
    }
    return false;
}


问题


面经


文章

微信
公众号

扫码关注公众号