Skip to content

Package: DmrToRootEClassConverter

DmrToRootEClassConverter

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 EclipseSource Muenchen GmbH 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: * lucas - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.core.services.segments;
15:
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
18:
19: /**
20: * Determines the root {@link EClass} for a subset of legacy domain model references. Do not use this directly, use
21: * {@link LegacyDmrToRootEClass} instead.
22: *
23: * @author Lucas Koehler
24: * @since 1.22
25: */
26: public interface DmrToRootEClassConverter {
27:
28:         /**
29:          * The value that expresses that a {@link DmrToRootEClassConverter} is not applicable for a
30:          * {@link VDomainModelReference}.
31:          */
32:         double NOT_APPLICABLE = Double.NEGATIVE_INFINITY;
33:
34:         /**
35:          * Returns a double that expresses if and how suitable this DmrToRootEClassConverter is for the given
36:          * {@link VDomainModelReference}.
37:          *
38:          * @param dmr The {@link VDomainModelReference}
39:          * @return The value indicating how suitable this tester is, {@link #NOT_APPLICABLE} if it can't work with the given
40:          * {@link VDomainModelReference}.
41:          */
42:         double isApplicable(VDomainModelReference dmr);
43:
44:         /**
45:          * Determines the root {@link EClass} of the given legacy domain model reference. Throws an exception if the root
46:          * EClass could not be determined because this means that the given DMR is invalid.
47:          *
48:          * @param dmr The {@link VDomainModelReference} whose root EClass is calculated
49:          * @return The root EClass of the given dmr
50:          * @throws IllegalArgumentException if the root EClass cannot be determined because of an invalid dmr
51:          */
52:         EClass getRootEClass(VDomainModelReference dmr) throws IllegalArgumentException;
53: }