本文整理匯總了Java中org.eclipse.emf.ecore.EcoreFactory.createEClass方法的典型用法代碼示例。如果您正苦於以下問題:Java EcoreFactory.createEClass方法的具體用法?Java EcoreFactory.createEClass怎麽用?Java EcoreFactory.createEClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EcoreFactory
的用法示例。
在下文中一共展示了EcoreFactory.createEClass方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAdapterIsCleared
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Test public void testAdapterIsCleared() throws Exception {
EcoreFactory factory = EcoreFactory.eINSTANCE;
EClass eClass = factory.createEClass();
Resource resource = new ResourceImpl();
resource.getContents().add(eClass);
CacheAdapter ca = new OnChangeEvictingCache().getOrCreate(resource);
setValue(ca);
EAttribute attribute = factory.createEAttribute();
assertIsSet(ca);
eClass.getEStructuralFeatures().add(attribute);
assertIsNull(ca);
setValue(ca);
attribute.setName("Foo");
assertIsNull(ca);
setValue(ca);
}
示例2: initialize
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void initialize() {
EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
testClass = ecoreFactory.createEClass();
testReference = ecoreFactory.createEReference();
testReference.setEType(testClass);
testReference.setContainment(true);
testClass.getEStructuralFeatures().add(testReference);
testReference2 = ecoreFactory.createEReference();
testReference2.setEType(testClass);
testReference2.setContainment(true);
testClass.getEStructuralFeatures().add(testReference2);
testPackage = ecoreFactory.createEPackage();
testPackage.getEClassifiers().add(testClass);
testPackage.setNsURI("http:///com.avaloq.tools.ddk.xtext.test");
EPackage.Registry.INSTANCE.put(testPackage.getNsURI(), testPackage);
}
示例3: setUp
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Override
public void setUp() {
super.setUp();
final EcoreFactory factory = EcoreFactory.eINSTANCE;
final EClass baseClass = factory.createEClass();
baseClass.setName("Base");
EList<EObject> _contents = this.primaryResource.getContents();
_contents.add(baseClass);
final EClass superClass = factory.createEClass();
superClass.setName("SuperClass");
EList<EObject> _contents_1 = this.referencedResource.getContents();
_contents_1.add(superClass);
EList<EClass> _eSuperTypes = baseClass.getESuperTypes();
_eSuperTypes.add(superClass);
}
示例4: getResource
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private Resource getResource(String resourceURI, String references) {
XMIResourceImpl res = new XMIResourceImpl();
res.setURI(URI.createURI(resourceURI));
EcoreFactory f = EcoreFactory.eINSTANCE;
EClass class1 = f.createEClass();
res.getContents().add(class1);
class1.setName("mytype");
if (references!=null) {
EClass referencedProxy = f.createEClass();
String fragment = res.getURIFragment(class1);
((InternalEObject)referencedProxy).eSetProxyURI(URI.createURI(references).appendFragment(fragment));
class1.getESuperTypes().add(referencedProxy);
}
return res;
}
示例5: setUp
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
resource = new XMLResourceImpl();
resource.setURI(URI.createURI("foo:/test"));
nameProvider = new IQualifiedNameProvider.AbstractImpl() {
@Override
public QualifiedName getFullyQualifiedName(EObject obj) {
if (obj instanceof ENamedElement)
return QualifiedName.create(((ENamedElement) obj).getName());
return null;
}
};
strategy = new DefaultResourceDescriptionStrategy();
strategy.setQualifiedNameProvider(nameProvider);
description = new DefaultResourceDescription(resource, strategy);
EcoreFactory f = EcoreFactory.eINSTANCE;
pack = f.createEPackage();
pack.setName("MyPackage");
eClass = f.createEClass();
eClass.setName("MyEClass");
dtype = f.createEDataType();
dtype.setName("MyDatatype");
pack.getEClassifiers().add(eClass);
pack.getEClassifiers().add(dtype);
resource.getContents().add(pack);
}
示例6: createEClass
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private EClass createEClass(final String name, final EClass... superTypes) {
EcoreFactory modelFactory = EcoreFactory.eINSTANCE;
EClass clazz = modelFactory.createEClass();
clazz.setName(name);
for (EClass superType : superTypes) {
clazz.getESuperTypes().add(superType);
}
testModelPackage.getEClassifiers().add(clazz);
return clazz;
}
示例7: createEClass
import org.eclipse.emf.ecore.EcoreFactory; //導入方法依賴的package包/類
private EClass createEClass(ResultSet resultSet) throws SQLException {
EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
EPackage ePackage = ecoreFactory.createEPackage();
ePackage.setName("PIPPO");
ePackage.setNsPrefix("asup");
ePackage.setNsURI("http://asup");
EClass eClass = ecoreFactory.createEClass();
eClass.setName(this.getClass().getSimpleName());
eClass.getESuperTypes().add(QOperatingSystemOutputPackage.eINSTANCE.getObjectRow());
ePackage.getEClassifiers().add(eClass);
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
for (int c = 1; c <= resultSetMetaData.getColumnCount(); c++) {
String columnName = resultSetMetaData.getColumnName(c);
int columnLength = resultSetMetaData.getPrecision(c);
EAttribute eAttribute = ecoreFactory.createEAttribute();
eAttribute.setName(columnName);
eAttribute.setEType(EcorePackage.eINSTANCE.getEString());
EAnnotation eAnnotation = ecoreFactory.createEAnnotation();
eAnnotation.setSource(QIntegratedLanguageDataPackage.eNS_PREFIX);
eAnnotation.getReferences().add(QIntegratedLanguageDataPackage.eINSTANCE.getCharacterDef());
eAnnotation.getDetails().put("length", Integer.toString(columnLength));
eAttribute.getEAnnotations().add(eAnnotation);
eClass.getEStructuralFeatures().add(eAttribute);
}
return eClass;
}