Skip to content

Package: PreSetValidator

PreSetValidator

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-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.internal.common.prevalidation;
15:
16: import java.util.Map;
17:
18: import org.eclipse.emf.common.util.DiagnosticChain;
19: import org.eclipse.emf.ecore.EDataType;
20:
21: /**
22: * A {@link PreSetValidator} validates a value against a given data type, before it gets set in the model.
23: *
24: */
25: public interface PreSetValidator {
26:
27:         /**
28:          * Validates the object in the given context, optionally producing diagnostics.
29:          *
30:          * @param eDataType the {@link org.eclipse.emf.ecore.EDataType EDataType} to validate the value against
31:          * @param value the value to be validated
32:          * @param diagnostics a place to accumulate diagnostics; if it's <code>null</code>, no diagnostics should be
33:          * produced.
34:          * @param context a place to cache information, if it's <code>null</code>, no cache is supported.
35:          * @return whether the object is valid.
36:          */
37:         boolean validate(EDataType eDataType, Object value, DiagnosticChain diagnostics, Map<Object, Object> context);
38: }