Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-12-14 12:17:15 +0000
committerEike Stepper2019-12-14 12:17:15 +0000
commitbbc713c9c99479824038894dbb055bcf1a4bc27f (patch)
tree65d5b722eeeaae5ad7feeef7c5269f0bf860abd4 /plugins/org.eclipse.emf.cdo.common/src
parentfb21060053c5e2d335aedde561619bf46bff7368 (diff)
downloadcdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.tar.gz
cdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.tar.xz
cdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.zip
[Releng] Deprecate org.eclipse.net4j.util.Predicate in favor of java.util.function.Predicate
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java97
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java14
8 files changed, 170 insertions, 28 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java
new file mode 100644
index 0000000000..54497f0eab
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2009-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ * Simon McDuff - maintenance
+ * Christian W. Damus (CEA) - support registered dynamic UML profiles
+ * Christian W. Damus (CEA) - don't process EAnnotations for proxy resolution
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.function.Predicate;
+
+/**
+ * Predefined {@link java.util.function.Predicate predicates} to test for various {@link EStructuralFeature feature} types.
+ *
+ * @author Eike Stepper
+ * @since 4.9
+ */
+public final class EMFPredicates
+{
+ public static final Predicate<EStructuralFeature> ATTRIBUTES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ return feature instanceof EAttribute;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ return feature instanceof EReference;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CONTAINER_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return reference.isContainer();
+ }
+
+ return false;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CROSS_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return !(reference.isContainer() || reference.isContainment());
+ }
+
+ return false;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return reference.isContainment();
+ }
+
+ return false;
+ }
+ };
+
+ private EMFPredicates()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index cac18804f1..dea292b4ee 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -16,7 +16,6 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.emf.common.notify.Adapter;
@@ -118,8 +117,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#ATTRIBUTES}.
*/
- public static final Predicate<EStructuralFeature> ATTRIBUTES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> ATTRIBUTES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -130,8 +131,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -142,8 +145,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CONTAINER_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CONTAINER_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINER_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -160,8 +165,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CROSS_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CROSS_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CROSS_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -178,8 +185,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CONTAINMENT_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
index 24895827bb..34dad18943 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
@@ -12,8 +12,6 @@ package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder;
import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
@@ -118,6 +116,13 @@ public interface CDORevisionData
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link #accept(CDORevisionValueVisitor, java.util.function.Predicate)}.
+ */
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter);
+
+ /**
+ * @since 4.9
*/
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter);
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
index 14d4ab253a..0ccbd221a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
@@ -19,8 +19,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDODetachedRevisionDeltaImpl;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -99,6 +97,13 @@ public interface CDORevisionDelta extends CDORevisionKey
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link #accept(CDOFeatureDeltaVisitor, java.util.function.Predicate)}.
+ */
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter);
+
+ /**
+ * @since 4.9
*/
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter);
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
index 25c462391d..44b62fbcaa 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
@@ -18,8 +18,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -119,7 +117,14 @@ public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta
}
@Override
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
index 943d0223c9..e5b635f3a1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
@@ -41,8 +41,6 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
-import org.eclipse.net4j.util.Predicate;
-import org.eclipse.net4j.util.Predicates;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.common.util.ECollections;
@@ -370,16 +368,23 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta, ListCompa
@Override
public void accept(CDOFeatureDeltaVisitor visitor)
{
- accept(visitor, Predicates.<EStructuralFeature> alwaysTrue());
+ accept(visitor, (java.util.function.Predicate<EStructuralFeature>)t -> true);
}
@Override
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ accept(visitor, org.eclipse.net4j.util.Predicates.toJava8(filter));
+ }
+
+ @Override
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
for (CDOFeatureDelta featureDelta : featureDeltas.values())
{
EStructuralFeature feature = featureDelta.getFeature();
- if (filter.apply(feature))
+ if (filter.test(feature))
{
((CDOFeatureDeltaImpl)featureDelta).accept(visitor);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
index 72af3ac9da..11b011fbca 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
@@ -28,8 +28,6 @@ import org.eclipse.emf.cdo.spi.common.model.InternalCDOClassInfo;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.Predicate;
-import org.eclipse.net4j.util.Predicates;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -193,18 +191,28 @@ public abstract class AbstractCDORevision implements InternalCDORevision
@Override
public void accept(CDORevisionValueVisitor visitor)
{
- accept(visitor, Predicates.<EStructuralFeature> alwaysTrue());
+ accept(visitor, (java.util.function.Predicate<EStructuralFeature>)t -> true);
}
/**
* @since 4.2
*/
@Override
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ accept(visitor, org.eclipse.net4j.util.Predicates.toJava8(filter));
+ }
+
+ /**
+ * @since 4.9
+ */
+ @Override
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
for (EStructuralFeature feature : classInfo.getAllPersistentFeatures())
{
- if (filter.apply(feature))
+ if (filter.test(feature))
{
if (feature.isMany())
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
index 79696e010f..4c9dcacb3e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
@@ -27,8 +27,6 @@ import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOClassInfo;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -522,7 +520,17 @@ public abstract class DelegatingCDORevision implements InternalCDORevision
* @since 4.2
*/
@Override
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ getDelegate().accept(visitor, filter);
+ }
+
+ /**
+ * @since 4.2
+ */
+ @Override
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
getDelegate().accept(visitor, filter);
}

Back to the top