javax.persistence.metamodel.StaticMetamodel源码实例Demo

类javax.persistence.metamodel.StaticMetamodel源码实例Demo

下面列出了javax.persistence.metamodel.StaticMetamodel 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-data-jpa-entity-graph   文件: Generator.java
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  if (roundEnv.processingOver() || annotations.isEmpty()) {
    return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
  }

  roundEnv
      .getElementsAnnotatedWith(StaticMetamodel.class)
      .stream()
      .map(TypeElement.class::cast)
      .map(typeElement -> new MetamodelClass(elements, types, typeElement))
      .forEach(metamodelClass -> metamodelClass.writeEntityGraphTo(filer));

  return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
}
 
源代码2 项目: zstack   文件: MysqlQueryBuilderImpl3.java
private void populateEntityInfo() throws NoSuchMethodException {
    Set<Class<?>> metaClasses = BeanUtils.reflections.getTypesAnnotatedWith(StaticMetamodel.class);
    for (Class it : metaClasses) {
        StaticMetamodel at = (StaticMetamodel) it.getAnnotation(StaticMetamodel.class);
        metaModelClasses.put(at.value(), it);
    }

    Set<Class<?>> invClasses = BeanUtils.reflections.getTypesAnnotatedWith(Inventory.class);

    for (Class invClass : invClasses) {
        EntityInfo info = buildEntityInfo(invClass);

        if (info.inventoryAnnotation.parent().length > 0) {
            Parent pat = info.inventoryAnnotation.parent()[0];
            Class pinvClass = pat.inventoryClass();
            DebugUtils.Assert(pinvClass.isAnnotationPresent(Inventory.class), String.format("inventory[%s]'s parent inventory class[%s] is not annotated by @Inventory", info.inventoryClass.getName(), pinvClass.getName()));
            EntityInfo pinfo = buildEntityInfo(pinvClass);
            info.parent = pinfo;
            pinfo.children.add(info);
        }

    }

    for (EntityInfo e : entityInfos.values()) {
        e.buildFlatTypeEntityMap();
    }
}
 
源代码3 项目: spring-data-jpa-entity-graph   文件: Generator.java
@Override
public Set<String> getSupportedAnnotationTypes() {
  return Collections.singleton(StaticMetamodel.class.getCanonicalName());
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法