Skip to content

Package: EStructuralFeatureValueConverterService

EStructuralFeatureValueConverterService

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 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: * mathias - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.common.converter;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecore.EStructuralFeature;
18:
19: /**
20: * @author Mathias Schaefer <mschaefer@eclipsesource.com>
21: * @since 1.11
22: *
23: */
24: public interface EStructuralFeatureValueConverterService {
25:
26:         /**
27:          * Register the given value converter.
28:          *
29:          * @param converter to add to the registry
30:          */
31:         void addValueConverter(EStructuralFeatureValueConverter converter);
32:
33:         /**
34:          * Unregister the given value converter.
35:          *
36:          * @param converter to remove from the registry
37:          */
38:         void removeValueConverter(EStructuralFeatureValueConverter converter);
39:
40:         /**
41:          * Convert literal to Object.
42:          *
43:          * @param eObject of the feature (optional, can be null)
44:          * @param feature target feature
45:          * @param literal to convert
46:          * @return converted object (null if conversion failed)
47:          */
48:         Object convertToModelValue(EObject eObject, EStructuralFeature feature, String literal);
49:
50:         /**
51:          * Convert value instance to literal.
52:          *
53:          * @param eObject (optional, can be null)
54:          * @param feature source feature
55:          * @param instance to convert
56:          * @return converted object (commonly a string literal, null if conversion failed)
57:          */
58:         Object convertToLiteral(EObject eObject, EStructuralFeature feature, Object instance);
59: }