Skip to content

Commit 6ecf8b0

Browse files
committed
[E4 XPath] Deprecate unsuitable XPathContextFactory methods for removal
1 parent c9f129d commit 6ecf8b0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathContextFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package org.eclipse.e4.emf.xpath;
1515

1616
import org.eclipse.e4.emf.internal.xpath.JXPathContextFactoryImpl;
17+
import org.eclipse.emf.ecore.EObject;
1718

1819
/**
1920
* Factory responsible to create an XPath-Context
@@ -38,13 +39,20 @@ public abstract class XPathContextFactory<T> {
3839
* @param parentContext parent context
3940
* @param contextBean Object
4041
* @return XPathContext
42+
* @deprecated The parent-context does not provide any real value. Just use
43+
* {@link #newContext(Object)}
4144
*/
45+
@Deprecated(forRemoval = true, since = "2025-03 (removal in 2027-03 or later)")
4246
public abstract XPathContext newContext(XPathContext parentContext, T contextBean);
4347

4448
/**
4549
* @param <T> the object type the xpath is created for
4650
* @return Create a new XPath-Factory
51+
* @deprecated The implementation returned by this method just supports
52+
* {@link EObject} elements. Use a specializd factory instead like
53+
* {@link EcoreXPathContextFactory}.
4754
*/
55+
@Deprecated(forRemoval = true, since = "2025-03 (removal in 2027-03 or later)")
4856
public static <T> XPathContextFactory<T> newInstance() {
4957
return new JXPathContextFactoryImpl<>();
5058
}

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesApplicationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void setUp() {
7373
xpathContext = f.newContext(resource.getContents().get(0));
7474
URI childUri = URI.createPlatformPluginURI("/org.eclipse.e4.emf.xpath.test/model/fragment.e4xmi", true);
7575
childResource = resourceSet.getResource(childUri, true);
76-
xpathChildContext = f.newContext(xpathContext, childResource.getContents().get(0));
76+
xpathChildContext = f.newContext(childResource.getContents().get(0));
7777
}
7878

7979
@After

tests/org.eclipse.e4.emf.xpath.test/src/org/eclipse/e4/emf/xpath/test/ExampleQueriesTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void testRelative() {
131131
EObject context = resource.getContents().get(0);
132132
List<EObject> eContents = context.eContents();
133133
EObject firstElement = eContents.get(0);
134-
XPathContext nestedXpathContext = xpathContextFactory.newContext(xpathContext, firstElement);
134+
XPathContext nestedXpathContext = xpathContextFactory.newContext(firstElement);
135135

136136
List<Node> dotList = nestedXpathContext.stream(".", Node.class).toList();
137137
assertEquals(1, dotList.size());

0 commit comments

Comments
 (0)