java类org.eclipse.emf.ecore.impl.EPackageImpl的实例源码

CheckGenModelUtil.java 文件源码 项目:dsl-devkit 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Returns the qualified package interface name for the given epackage (model).
 *
 * @param ePackage
 *          the model
 * @return the package interface name
 */
public static String getQualifiedPackageInterfaceName(final EPackage ePackage) {
  if (ePackage.getClass() == EPackageImpl.class) {
    // EPackage loaded from ecore model
    GenPackage genPackage = findGenPackage(ePackage);
    if (genPackage != null) {
      return genPackage.getQualifiedPackageInterfaceName();
    }
  } else {
    // EPackage loaded from Java
    Class<?>[] interfaces = ePackage.getClass().getInterfaces();
    if (interfaces != null && interfaces.length > 0) {
      return interfaces[0].getName();
    }
  }
  return null;
}
DirectWriteMapStore.java 文件源码 项目:NeoEMF 阅读 17 收藏 0 点赞 0 评论 0
@Override
public PersistentEObject apply(Id id) {
    PersistentEObject object;
    EClass eClass = DirectWriteMapStore.this.resolveInstanceOf(id);
    if (nonNull(eClass)) {
        EObject eObject;
        if (Objects.equals(eClass.getEPackage().getClass(), EPackageImpl.class)) {
            // Dynamic EMF
            eObject = PersistenceFactory.getInstance().create(eClass);
        }
        else {
            eObject = EcoreUtil.create(eClass);
        }
        object = PersistentEObject.from(eObject);
        object.id(id);
        object.setMapped(true);
    }
    else {
        throw new RuntimeException("Element " + id + " does not have an associated EClass");
    }
    return object;
}
DirectWriteHBaseStore.java 文件源码 项目:NeoEMF 阅读 19 收藏 0 点赞 0 评论 0
@Override
public PersistentEObject apply(Id id) {
    PersistentEObject object;
    EClass eClass = DirectWriteHBaseStore.this.resolveInstanceOf(id);
    if (nonNull(eClass)) {
        EObject eObject;
        if (Objects.equals(eClass.getEPackage().getClass(), EPackageImpl.class)) {
            // Dynamic EMF
            eObject = PersistenceFactory.getInstance().create(eClass);
        }
        else {
            eObject = EcoreUtil.create(eClass);
        }
        object = PersistentEObject.from(eObject);
        object.id(id);
        object.setMapped(true);
    }
    else {
        throw new RuntimeException("Element " + id + " does not have an associated EClass");
    }
    return object;
}
BlueprintsPersistenceBackend.java 文件源码 项目:NeoEMF 阅读 21 收藏 0 点赞 0 评论 0
@Override
public PersistentEObject apply(Id id) {
    PersistentEObject object;
    if(isNull(eClass)) {
        /*
         *  Use the embedded vertex to compute the eClass instead of the id to avoid
         *  a backend query to retrieve the vertex
         */
        eClass = BlueprintsPersistenceBackend.this.resolveInstanceOf(vertex);
    }
    if (nonNull(eClass)) {
        EObject eObject;
        if (Objects.equals(eClass.getEPackage().getClass(), EPackageImpl.class)) {
            // Dynamic EMF
            eObject = PersistenceFactory.getInstance().create(eClass);
        }
        else {
            eObject = EcoreUtil.create(eClass);
        }
        object = PersistentEObject.from(eObject);
        object.id(id);
        object.setMapped(true);
    }
    else {
        throw new RuntimeException("Element " + id + " does not have an associated EClass");
    }
    return object;
}
EcoreUtil.java 文件源码 项目:eclipse-avro 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Marks the package to indicate that it and everything it contains or that its contents depend on can no longer be changed.
 * This helps to improve the performance of the model but has no other effect.
 */
public static void freeze(EPackage ePackage)
{
  try
  {
    ((EPackageImpl)ePackage).freeze();
  }
  catch (ClassCastException exception)
  {
    // Ignore if we can't freeze.
  }
}
EcoreUtil.java 文件源码 项目:clickwatch 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Marks the package to indicate that it and everything it contains or that its contents depend on can no longer be changed.
 * This helps to improve the performance of the model but has no other effect.
 */
public static void freeze(EPackage ePackage)
{
  try
  {
    ((EPackageImpl)ePackage).freeze();
  }
  catch (ClassCastException exception)
  {
    // Ignore if we can't freeze.
  }
}
GenModelUtil2.java 文件源码 项目:dsl-devkit 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Returns the qualified package interface name for the given epackage (model).
 *
 * @param ePackage
 *          the model
 * @return the package interface name
 */
public static String qualifiedPackageInterfaceName(final EPackage ePackage) {
  return ePackage.getClass() == EPackageImpl.class ? findGenPackage(ePackage).getQualifiedPackageInterfaceName()
      : ePackage.getClass().getInterfaces()[0].getName();
}


问题


面经


文章

微信
公众号

扫码关注公众号