org.eclipse.emf.ecore.impl.EPackageImpl Java Examples

The following examples show how to use org.eclipse.emf.ecore.impl.EPackageImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CheckGenModelUtil.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: GenModelUtil2.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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();
}