Class ValidationUtils
- java.lang.Object
-
- net.ssehub.easy.dslCore.validation.ValidationUtils
-
public class ValidationUtils extends java.lang.ObjectSome validation helper methods.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceValidationUtils.IModelValidationCallback<R,T>Defines a validation callback to provide the information required for validation.static classValidationUtils.MessageTypeDefines common xText error types.
-
Field Summary
Fields Modifier and Type Field Description static booleanPERFORM_XTEXT_VALIDATIONPerform Xtext validation or emulate problem markers on editor save (partial parsing problem).
-
Constructor Summary
Constructors Constructor Description ValidationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R extends org.eclipse.emf.ecore.EObject,T>
voidcheckModel(R unit, ValidationUtils.IModelValidationCallback<R,T> callback, boolean debug)Checks the model on top-level element layer.private static org.eclipse.emf.common.util.DiagnosticcreateDiagnostic(org.eclipse.xtext.diagnostics.Severity severity, java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)Creates an EMF Eclipse diagnostic instance.private static EASyLoggerFactory.EASyLoggergetLogger()Returns the responsible logger.static org.eclipse.emf.common.util.DiagnosticprocessMessage(Message message)Processes amessage.static voidprocessMessages(TranslationResult<?> result, org.eclipse.emf.common.util.BasicDiagnostic diagnostic)Processes messages.private static inttoDiagnosticSeverity(org.eclipse.xtext.diagnostics.Severity severity)Converts an xText severity into a diagnostic severity.
-
-
-
Field Detail
-
PERFORM_XTEXT_VALIDATION
public static final boolean PERFORM_XTEXT_VALIDATION
Perform Xtext validation or emulate problem markers on editor save (partial parsing problem).- See Also:
- Constant Field Values
-
-
Method Detail
-
processMessages
public static void processMessages(TranslationResult<?> result, org.eclipse.emf.common.util.BasicDiagnostic diagnostic)
Processes messages.- Parameters:
result- the translation result to take the messages fromdiagnostic- the diagnostic instance to add messages to
-
processMessage
public static org.eclipse.emf.common.util.Diagnostic processMessage(Message message)
Processes amessage.- Parameters:
message- the message to be processed- Returns:
- the related Eclipse diagnosic instance
-
createDiagnostic
private static org.eclipse.emf.common.util.Diagnostic createDiagnostic(org.eclipse.xtext.diagnostics.Severity severity, java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)Creates an EMF Eclipse diagnostic instance.- Parameters:
severity- the severity of the diagnosticmessage- the messageobject- the causing EMF element in the parse treefeature- the causing grammar featureindex- an optional index value (aka code)code- a textual description of the code (may be null)issueData- optional user specific data- Returns:
- the created diagnostic element
-
toDiagnosticSeverity
private static int toDiagnosticSeverity(org.eclipse.xtext.diagnostics.Severity severity)
Converts an xText severity into a diagnostic severity.- Parameters:
severity- the xText severity- Returns:
- the diagnostic severity
-
getLogger
private static final EASyLoggerFactory.EASyLogger getLogger()
Returns the responsible logger.- Returns:
- the responsible logger
-
checkModel
public static <R extends org.eclipse.emf.ecore.EObject,T> void checkModel(R unit, ValidationUtils.IModelValidationCallback<R,T> callback, boolean debug)Checks the model on top-level element layer.- Type Parameters:
R- the model root typeT- the transformation result type- Parameters:
unit- the variability unit to start tests withcallback- the callback providing relevant model informationdebug- shall debug information be emitted
-
-