Skip to content

Package: IFeatureConstraint

IFeatureConstraint

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017 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: * Edgar Mueller - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.common.validation;
15:
16: import java.util.Map;
17:
18: import org.eclipse.emf.common.util.Diagnostic;
19: import org.eclipse.emf.ecore.EStructuralFeature;
20:
21: /**
22: * Interface that checks whether a given value
23: * complies with constraints defined by a given feature.
24: *
25: * @since 1.13
26: */
27: public interface IFeatureConstraint {
28:
29:         /**
30:          * Context map key to retrieve the the root EObject (may be null).
31:          */
32:         String E_ROOT_OBJECT = "rootEObject"; //$NON-NLS-1$
33:
34:         /**
35:          * Validate a given value against constraints defined by the {@link org.eclipse.emf.ecore.EDataType EDataType}
36:          * of the {@link EStructuralFeature}.
37:          *
38:          * @param eStructuralFeature the feature that defines any constraints
39:          * @param value the value to be validated
40:          * @param context the validation context, may be <code>null</code>
41:          * @return a {@link Diagnostic} describing any potential errors
42:          */
43:         Diagnostic validate(EStructuralFeature eStructuralFeature, Object value, Map<Object, Object> context);
44: }