當前位置: 首頁>>代碼示例>>Java>>正文


Java EcoreFactory.createEClass方法代碼示例

本文整理匯總了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);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:17,代碼來源:OnChangeEvictingCacheAdapterTest.java

示例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);
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:22,代碼來源:ShortFragmentProviderTest.java

示例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);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:16,代碼來源:AbstractURIHandlerWithEcoreTest.java

示例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;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:ResourceSetReferencingResourceSetTest.java

示例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);

}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:28,代碼來源:DefaultResourceDescriptionTest.java

示例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;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:11,代碼來源:AbstractTypeProviderTest.java

示例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;
	}
 
開發者ID:asupdev,項目名稱:asup,代碼行數:39,代碼來源:SQLStatementRunner.java


注:本文中的org.eclipse.emf.ecore.EcoreFactory.createEClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。