Class Message
java.lang.Object
net.ssehub.easy.basics.messages.Message
net.ssehub.easy.dslCore.translation.Message
- All Implemented Interfaces:
net.ssehub.easy.basics.messages.IMessage
public class Message
extends net.ssehub.easy.basics.messages.Message
Implements a message issues by the model translator (in order to provide
feedback on multiple issues at once).
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classRepresents an issue location. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.eclipse.emf.ecore.EObjectStores the ECore element causing the error.private org.eclipse.emf.ecore.EStructuralFeatureStores the (sub-)feature ofcause.private intA code representing the message.static final intDefines the code used for messages which can be ignored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringfieldToString(Object obj, Class<?> cls, String field) Tries to obtain the value of the fieldfieldfromobjas a String.private static StringfieldToString(Object obj, String field) Tries to obtain the value of the fieldfieldfromobjas a String.org.eclipse.emf.ecore.EObjectgetCause()Returns the cause of the message (in terms of the causing ECore element).org.eclipse.emf.ecore.EStructuralFeatureReturns the causing feature (withingetCause()).intgetCode()Returns a code for the message.protected Message.IssueLocationgetLocationData(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, int index) Returns the location for a given causeobj,structuralFeatueand index of the node withinobj.protected Message.IssueLocationgetLocationForNode(org.eclipse.xtext.nodemodel.INode node) Returns the issue location for the givennode.protected Message.IssueLocationgetLocationForNode(org.eclipse.xtext.nodemodel.INode node, int offset, int length) Computes theMessage.IssueLocationfor the given offset and length in the given node.booleanignore()Returns whether this message can be ignored.Methods inherited from class net.ssehub.easy.basics.messages.Message
containsError, getDescription, getStatus, toString
-
Field Details
-
CODE_IGNORE
public static final int CODE_IGNOREDefines the code used for messages which can be ignored.- See Also:
-
cause
private org.eclipse.emf.ecore.EObject causeStores the ECore element causing the error. -
causingFeature
private org.eclipse.emf.ecore.EStructuralFeature causingFeatureStores the (sub-)feature ofcause. -
code
private int codeA code representing the message.- See Also:
-
-
Constructor Details
-
Message
public Message(String message, net.ssehub.easy.basics.messages.Status status, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causingFeature, int code) Creates a message object.- Parameters:
message- the message textstatus- the message statuscause- the ECore element causing the messagecausingFeature- the feature withincausecode- a numerical code representing the message (seeCODE_IGNORE)
-
-
Method Details
-
getCause
public org.eclipse.emf.ecore.EObject getCause()Returns the cause of the message (in terms of the causing ECore element).- Returns:
- the cause of the message
-
getCausingFeature
public org.eclipse.emf.ecore.EStructuralFeature getCausingFeature()Returns the causing feature (withingetCause()).- Returns:
- the causing feature
-
getCode
public int getCode()Returns a code for the message.- Returns:
- the code
-
ignore
public boolean ignore()Returns whether this message can be ignored.- Returns:
trueif it can be ignored,falseelse
-
getDetailedDescription
- Specified by:
getDetailedDescriptionin interfacenet.ssehub.easy.basics.messages.IMessage- Overrides:
getDetailedDescriptionin classnet.ssehub.easy.basics.messages.Message
-
getLocationForNode
Returns the issue location for the givennode.- Parameters:
node- the node to return the location for- Returns:
- the issue location
-
getLocationForNode
protected Message.IssueLocation getLocationForNode(org.eclipse.xtext.nodemodel.INode node, int offset, int length) Computes theMessage.IssueLocationfor the given offset and length in the given node.- Parameters:
node- the nodeoffset- the text offset of the nodelength- the text length of the node- Returns:
- the issue location
-
getLocationData
protected Message.IssueLocation getLocationData(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, int index) Returns the location for a given causeobj,structuralFeatueand index of the node withinobj.- Parameters:
obj- the object to look intostructuralFeature- the structural feature withinobjindex- the node index withinobj, usually0- Returns:
- the location, may be the beginning of a document if the parse nodes cannot be found (may be null)
-
fieldToString
Tries to obtain the value of the fieldfieldfromobjas a String.- Parameters:
obj- the object to queryfield- the name of the field to query- Returns:
- the value of the field as String, may be null if
fielddoes not exist. - See Also:
-
fieldToString
Tries to obtain the value of the fieldfieldfromobjas a String.- Parameters:
obj- the object to querycls- the class ofobjto use (immediate or parent)field- the name of the field to query- Returns:
- the value of the field as String, may be null if
fielddoes not exist.
-