Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<copyright> Copyright (c) 2009, 2010 Springsite BV (The Netherlands) and others All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: Martin Taal - Initial API and implementation </copyright> $Id:,v 1.22 2011/08/29 05:16:08 mtaal Exp $
package org.eclipse.emf.texo.model;
import  org.eclipse.emf.ecore.EClassifier;
import  org.eclipse.emf.ecore.EPackage;
import  org.eclipse.emf.ecore.EStructuralFeature;
The ModelPackage contains direct and efficient statics and provides access to the runtime model (the EPackage ) through generated methods. The ModelPackage is responsible for reading the model from an ecore file located in the same package. Each of the EClassifier instances in the model and each EStructuralFeature will have a generated constant and generated methods to have direct access to the model elements at runtime. The ModelPackage also provides a single access point to the ModelFactory through the getModelFactory() method and through the generated MODELFACTORY constant.

Martin Taal
public abstract class ModelPackage {
  // Store a local ref to the EPackage for performance reasons
  private EPackage ePackage = null;


the EPackage of this ModelPackage
  public EPackage getEPackage() {
    if ( == null) {
       = ModelUtils.getEPackage(getNsURI());
    return ;
  protected void setEPackage(EPackage ePackage) {
    this. = ePackage;

Returns the name of the ecore file holding the model represented by this class. Normally this file is present in the same java package as this class. In this case the return is just the ecore file name. The file name is used to read the ecore file from the classpath (see ModelUtils.readEPackagesFromFile(ModelPackage)).

the name of the ecore file
  public abstract String getEcoreFileName();


the nsuri of the epackage
See also:
  public abstract String getNsURI();

Return the package ModelFactory specific for the instance of this ModelPackage. There is one global instance of this specific instance of the ModelFactory per ModelPackage.

the ModelFactory handling the creation of types for this ModelPackage
  public abstract ModelFactory getModelFactory();


the nsprefix of the epackage
See also:
  public String getNsPrefix() {
    return getEPackage().getNsPrefix();

Returns the Class implementing a specific EClassifier.

eClassifier the EClassifier
the implementation class
  public abstract Class<?> getEClassifierClass(org.eclipse.emf.ecore.EClassifier eClassifier);
  public String toString() {
    return "ModelPackage " + //$NON-NLS-1$
New to GrepCode? Check out our FAQ X