java类org.eclipse.emf.ecore.impl.EObjectImpl的实例源码

TestTransactionUtils.java 文件源码 项目:OpenSPIFe 阅读 17 收藏 0 点赞 0 评论 0
@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());
}
HyexpressionANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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;
}
HymanifestANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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;
}
HymappingANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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;
}
HyconstraintsANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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;
}
HyvalidityformulaANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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;
}
HydatavalueANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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;
}
DwprofileANTLRParserBase.java 文件源码 项目:DarwinSPL 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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;
}
PropertySourceProviderWrapper.java 文件源码 项目:mappingtools 阅读 13 收藏 0 点赞 0 评论 0
@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);
}


问题


面经


文章

微信
公众号

扫码关注公众号