Skip to content

Package: TemplateFilterService

TemplateFilterService

nameinstructionbranchcomplexitylinemethod
lambda$0(EObject, EReference)
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.core.services.datatemplate;
15:
16: import java.util.function.Predicate;
17:
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecore.EReference;
20: import org.eclipse.emfforms.bazaar.Vendor;
21: import org.eclipse.emfforms.datatemplate.Template;
22:
23: /**
24: * Protocol for a data template filter service.
25: *
26: * @since 1.21
27: */
28: public interface TemplateFilterService {
29:
30:         /**
31:          * A filter service that provides no filtering.
32:          */
33:         TemplateFilterService NULL = (owner, reference) -> null;
34:
35:         /**
36:          * Obtain a template filter applicable to templates provided for the given
37:          * {@code reference} of an {@code owner} object in the editor.
38:          *
39:          * @param owner the object owning a {@code reference} to be assigned from a template
40:          * @param reference a reference feature of the {@code owner} that is to be assigned from a template.
41:          * If the {@code reference} is a {@link EReference#isContainment() containment} then
42:          * the {@code owner} would be the {@link EObject#eContainer() container} of the template
43:          *
44:          * @return a predicate with which to filter templates (only templates satisfying the predicate
45:          * are retained), or else {@code null} to opt out of filtering
46:          */
47:         Predicate<? super Template> getTemplateFilter(EObject owner, EReference reference);
48:
49:         //
50:         // Nested types
51:         //
52:
53:         /**
54:          * Specific Bazaar vendor interface for {@link TemplateFilterService} providers.
55:          * It is intended that implementations be registered as OSGi services, for
56:          * clients of the template providers to find them and apply as appropriate
57:          * to the data templates that they obtain.
58:          *
59:          * @since 1.21
60:          */
61:         public interface Provider extends Vendor<TemplateFilterService> {
62:                 // Nothing to add to the superinterface
63:         }
64:
65: }