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


Java EObjectImpl類代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.impl.EObjectImpl的典型用法代碼示例。如果您正苦於以下問題:Java EObjectImpl類的具體用法?Java EObjectImpl怎麽用?Java EObjectImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EObjectImpl類屬於org.eclipse.emf.ecore.impl包,在下文中一共展示了EObjectImpl類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testNonTransactionWritting

import org.eclipse.emf.ecore.impl.EObjectImpl; //導入依賴的package包/類
@Test
public void testNonTransactionWritting() throws IOException {
	EditingDomain editingDomain = EMFUtils.createEditingDomain();
	ResourceSet resourceSet = editingDomain.getResourceSet();
	Resource resource = resourceSet.createResource(URI.createFileURI(FileUtilities.createTempFile("junit", "txt").toString()));
	
	EObject object = new EObjectImpl() {
		// make non-abstract
	};
	resource.getContents().add(object);
	assertEquals(resource, object.eResource());
	
	TransactionUtils.writing(object, new Runnable() {

		@Override
		public void run() {
			// trivial operation
		}
		
	});
	
	assertEquals(resource, object.eResource());
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:24,代碼來源:TestTransactionUtils.java

示例2: createDynamicProxy

import org.eclipse.emf.ecore.impl.EObjectImpl; //導入依賴的package包/類
/**
 * Creates a dynamic Java proxy that mimics the interface of the given class.
 */
@SuppressWarnings("unchecked")
public <T> T createDynamicProxy(Class<T> clazz) {
	Object proxy = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[]{clazz, EObject.class, InternalEObject.class}, new InvocationHandler() {
		
		private EObject dummyObject = new EObjectImpl() {};
		
		public Object invoke(Object object, Method method, Object[] args) throws Throwable {
			// search in dummyObject for the requested method
			Method[] methodsInDummy = dummyObject.getClass().getMethods();
			for (Method methodInDummy : methodsInDummy) {
				boolean matches = true;
				if (methodInDummy.getName().equals(method.getName())) {
					Class<?>[] parameterTypes = method.getParameterTypes();
					Class<?>[] parameterTypesInDummy = methodInDummy.getParameterTypes();
					if (parameterTypes.length == parameterTypesInDummy.length) {
						for (int p = 0; p < parameterTypes.length; p++) {
							Class<?> parameterType = parameterTypes[p];
							Class<?> parameterTypeInDummy = parameterTypesInDummy[p];
							if (!parameterType.equals(parameterTypeInDummy)) {
								matches = false;
							}
						}
					} else {
						matches = false;
					}
				} else {
					matches = false;
				}
				if (matches) {
					return methodInDummy.invoke(dummyObject, args);
				}
			}
			return null;
		}
	});
	return (T) proxy;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:41,代碼來源:HyexpressionANTLRParserBase.java

示例3: getPropertySource

import org.eclipse.emf.ecore.impl.EObjectImpl; //導入依賴的package包/類
@Override
public IPropertySource getPropertySource(Object object) {
	if (object instanceof EObjectImpl) // superclass for model classes such as NodeImpl
	{
		String cName = ((EObjectImpl)object).eClass().getName();
		IPropertySource ps = psp.getPropertySource(object);
		PropertySourceWrapper psw = new PropertySourceWrapper(ps,cName,pvsp);
		return psw;
	}
	return psp.getPropertySource(object);
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:12,代碼來源:PropertySourceProviderWrapper.java


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