EcoreUtil.java 文件源码

java
阅读 15 收藏 0 点赞 0 评论 0

项目:eclipse-avro 作者:
/**
 * Sets or removes annotations on the given structural feature to prevent generation of accessor methods in its interface.
 * @param eStructuralFeature the structural feature
 * @param accessor the type of accessor method, one of {@link #GET}, {@link #SET}, {@link #IS_SET}, or {@link #UNSET}
 * @param suppress whether the specified accessor's visibility should be suppressed
 * @since 2.1
 */
public static void setSuppressedVisibility(EStructuralFeature eStructuralFeature, int accessor, boolean suppress)
{
  if (accessor < GET || accessor > UNSET) throw new IllegalArgumentException("Invalid accessor identifier: " + accessor);

  EAnnotation eAnnotation = eStructuralFeature.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
  if (!suppress)
  {
    if (eAnnotation != null)
    {
      eAnnotation.getDetails().removeKey(ACCESSOR_KEYS[accessor]);
    }
  }
  else
  {
    if (eAnnotation == null)
    {
      eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
      eStructuralFeature.getEAnnotations().add(eAnnotation);
    }
    eAnnotation.getDetails().put(ACCESSOR_KEYS[accessor], TRUE);
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号