当前位置: 首页>>代码示例>>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;未经允许,请勿转载。