Skip to content

Package: DomainModelReferenceConverter

DomainModelReferenceConverter

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 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 Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.core.services.databinding;
15:
16: import org.eclipse.core.databinding.property.list.IListProperty;
17: import org.eclipse.core.databinding.property.value.IValueProperty;
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
20:
21: /**
22: * Converts a {@link VDomainModelReference} to a {@link IValueProperty}.
23: *
24: * @author Lucas Koehler
25: *
26: */
27: public interface DomainModelReferenceConverter {
28:
29:         /**
30:          * The constant defining the priority that a {@link DomainModelReferenceConverter} is not for a
31:          * {@link VDomainModelReference}.
32:          */
33:         double NOT_APPLICABLE = Double.NEGATIVE_INFINITY;
34:
35:         /**
36:          * Checks whether the given {@link VDomainModelReference} can be converted by this
37:          * {@link DomainModelReferenceConverter} to a {@link IValueProperty}. The return value is the priority of this
38:          * converter. The higher the priority, the better suits the converter the given {@link VDomainModelReference}.
39:          *
40:          * @param domainModelReference The {@link VDomainModelReference} whose priority is wanted.
41:          * @return The priority of the given {@link VDomainModelReference}; negative infinity if this converter is not
42:          * applicable.
43:          */
44:         double isApplicable(VDomainModelReference domainModelReference);
45:
46:         /**
47:          * Converts a {@link VDomainModelReference} to a {@link IValueProperty}.
48:          *
49:          * @param domainModelReference The {@link VDomainModelReference} that will be converted to a {@link IValueProperty}
50:          * @param object The root object of the rendered form
51:          * @return The created {@link IValueProperty}, does not return <code>null</code>.
52:          * @throws DatabindingFailedException if no value property could be created due to an invalid
53:          * {@link VDomainModelReference}.
54:          */
55:         IValueProperty convertToValueProperty(VDomainModelReference domainModelReference, EObject object)
56:                 throws DatabindingFailedException;
57:
58:         /**
59:          * Converts a {@link VDomainModelReference} to an {@link IListProperty}.
60:          *
61:          * @param domainModelReference The {@link VDomainModelReference} that will be converted to an {@link IListProperty}
62:          * @param object The root object of the rendered form
63:          * @return The created {@link IListProperty}, does not return <code>null</code>.
64:          * @throws DatabindingFailedException if no value property could be created due to an invalid
65:          * {@link VDomainModelReference}.
66:          */
67:         IListProperty convertToListProperty(VDomainModelReference domainModelReference, EObject object)
68:                 throws DatabindingFailedException;
69: }