Class LogMessageReceiver
- java.lang.Object
-
- net.ssehub.easy.dslCore.translation.MessageReceiver
-
- net.ssehub.easy.dslCore.translation.LogMessageReceiver
-
- All Implemented Interfaces:
IMessageReceiver
public class LogMessageReceiver extends MessageReceiver
A simple fallback receiver that does not store messages.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.emf.common.util.URIlocationHintprivate EASyLoggerFactory.EASyLoggerlogger
-
Constructor Summary
Constructors Constructor Description LogMessageReceiver(java.lang.Class<?> origin, java.lang.String bundleName)Creates a log message receiver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(Message msg)Adds a message.voidcollect(IMessage message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives an EASy message.voiderror(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives an error message.voiderror(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)Adds a diagnostic error, typically from a standalone parser configuration.intgetErrorCount()Returns the number of errors.private java.lang.StringgetLocation(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)Returns the location of diagnostic taking the location hint as fallback.MessagegetMessage(int index)Returns the specified message.intgetMessageCount()Returns the number of messages.voidsetLocationHint(org.eclipse.emf.common.util.URI locationHint)Defines a location hint in case that diagnostics do not carry this information.voidwarning(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives a warning message.-
Methods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver
error
-
-
-
-
Field Detail
-
logger
private EASyLoggerFactory.EASyLogger logger
-
locationHint
private org.eclipse.emf.common.util.URI locationHint
-
-
Method Detail
-
error
public void error(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Description copied from interface:IMessageReceiverReceives an error message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the error
-
warning
public void warning(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Description copied from interface:IMessageReceiverReceives a warning message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the warning
-
collect
public void collect(IMessage message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
Description copied from interface:IMessageReceiverReceives an EASy message. This allows re-directing the message while keeping the relation to the original one, e.g., for cleaning up messages.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the error
-
getMessageCount
public int getMessageCount()
Description copied from class:MessageReceiverReturns the number of messages.- Specified by:
getMessageCountin classMessageReceiver- Returns:
- the number of messages
-
getErrorCount
public int getErrorCount()
Description copied from class:MessageReceiverReturns the number of errors.- Specified by:
getErrorCountin classMessageReceiver- Returns:
- the number of errors
-
getMessage
public Message getMessage(int index)
Description copied from class:MessageReceiverReturns the specified message.- Specified by:
getMessagein classMessageReceiver- Parameters:
index- the position of the message to be returned- Returns:
- the specified message
-
error
public void error(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
Description copied from class:MessageReceiverAdds a diagnostic error, typically from a standalone parser configuration.- Specified by:
errorin classMessageReceiver- Parameters:
diagnostic- the diagnostic to be added
-
getLocation
private java.lang.String getLocation(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
Returns the location of diagnostic taking the location hint as fallback.- Parameters:
diagnostic- the diagnostic (may be null)- Returns:
- the location
-
setLocationHint
public void setLocationHint(org.eclipse.emf.common.util.URI locationHint)
Defines a location hint in case that diagnostics do not carry this information. Reset if not used.- Parameters:
locationHint- the location hint, may be null for none
-
addMessage
public void addMessage(Message msg)
Description copied from class:MessageReceiverAdds a message.- Specified by:
addMessagein classMessageReceiver- Parameters:
msg- the message to be added
-
-