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 http://www.eclipse.org/legal/epl-v10.html Contributors: Martin Taal - Initial API and implementation </copyright> $Id: ModelPackage.java,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.

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

  

Returns:
the EPackage of this ModelPackage
  public EPackage getEPackage() {
    if ( == null) {
       = ModelUtils.getEPackage(getNsURI());
      ModelUtils.setEFactoryProxy(this);
    }
    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)).

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

  

Returns:
the nsuri of the epackage
See also:
getEPackage()
getEPackage()
  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.

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

  

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

  
Returns the Class implementing a specific EClassifier.

Parameters:
eClassifier the EClassifier
Returns:
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