当前位置:   article > 正文

neo4j图数据库中创建关系的时候动态修改@RelationshipEntity(type = “xxx“)的关系名称_neo4j@relationship

neo4j@relationship
本方法是通过反射去获取类上注解的value值并修改
  1. @Data
  2. @NoArgsConstructor
  3. @RelationshipEntity(type = "属于")
  4. public class BelongToRelation extends AbstractRelation<CIType, CIType>{
  5. }
  1. public Class<BelongToRelation> updateAnnotationValue(String str) throws IllegalAccessException, NoSuchFieldException {
  2. Class<BelongToRelation> belongToRelationClass = BelongToRelation.class;
  3. RelationshipEntity annotation = belongToRelationClass.getAnnotation(RelationshipEntity.class);
  4. String type = annotation.type();
  5. System.out.println(type);
  6. //获取这个代理实例所持有的 InvocationHandler
  7. InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);
  8. // 获取 AnnotationInvocationHandler 的 memberValues 字段
  9. Field declaredField = invocationHandler.getClass().getDeclaredField("memberValues");
  10. // 因为这个字段事
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/727685
推荐阅读
相关标签
  

闽ICP备14008679号