Class Message
- java.lang.Object
-
- net.ssehub.easy.basics.messages.Message
-
- net.ssehub.easy.dslCore.translation.Message
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMessage.IssueLocationRepresents an issue location.
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.emf.ecore.EObjectcauseStores the ECore element causing the error.private org.eclipse.emf.ecore.EStructuralFeaturecausingFeatureStores the (sub-)feature ofcause.private intcodeA code representing the message.static intCODE_IGNOREDefines the code used for messages which can be ignored.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringfieldToString(java.lang.Object obj, java.lang.Class<?> cls, java.lang.String field)Tries to obtain the value of the fieldfieldfromobjas a String.private static java.lang.StringfieldToString(java.lang.Object obj, java.lang.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.EStructuralFeaturegetCausingFeature()Returns the causing feature (withingetCause()).intgetCode()Returns a code for the message.java.lang.StringgetDetailedDescription()Returns a detailed message description (if available) orIMessage.getDescription().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 Detail
-
CODE_IGNORE
public static final int CODE_IGNORE
Defines the code used for messages which can be ignored.- See Also:
- Constant Field Values
-
cause
private org.eclipse.emf.ecore.EObject cause
Stores the ECore element causing the error.
-
causingFeature
private org.eclipse.emf.ecore.EStructuralFeature causingFeature
Stores the (sub-)feature ofcause.
-
code
private int code
A code representing the message.- See Also:
CODE_IGNORE
-
-
Constructor Detail
-
Message
public Message(java.lang.String message, 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 Detail
-
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
public java.lang.String getDetailedDescription()
Description copied from interface:IMessageReturns a detailed message description (if available) orIMessage.getDescription(). Details may e.g., include file position or line number. As e.g. xText cares for location and position itself, this information would be superfluous there, but helpful in a command line context, where this method shall be used instead.- Specified by:
getDetailedDescriptionin interfaceIMessage- Overrides:
getDetailedDescriptionin classMessage- Returns:
- the (detailed) message description
-
getLocationForNode
protected Message.IssueLocation getLocationForNode(org.eclipse.xtext.nodemodel.INode node)
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
private static java.lang.String fieldToString(java.lang.Object obj, java.lang.String field)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(Object, Class, String)
-
fieldToString
private static java.lang.String fieldToString(java.lang.Object obj, java.lang.Class<?> cls, java.lang.String field)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.
-
-