- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.tentackle.model.ModelException
-
- All Implemented Interfaces:
Serializable
public class ModelException extends Exception
Model parsing exception.- Author:
- harald
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringAT_ELEMENTstring prepended to the source location.
-
Constructor Summary
Constructors Constructor Description ModelException(String message)Creates a model exception.ModelException(String message, Throwable cause)Creates a model exception.ModelException(String message, ModelElement element)Creates a model exception.ModelException(String message, ModelElement element, Throwable cause)Creates a model exception.ModelException(Collection<ModelError> errors)Creates a model exception from a collection of errors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelElementgetElement()Gets the related model element.StringgetMessage()booleanisRelatedTo(ModelElement otherElement)Returns whether given element is related to this exception.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
AT_ELEMENT
public static final String AT_ELEMENT
string prepended to the source location.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ModelException
public ModelException(String message, ModelElement element, Throwable cause)
Creates a model exception.- Parameters:
message- the error messageelement- the related model elementcause- the cause
-
ModelException
public ModelException(String message, ModelElement element)
Creates a model exception.- Parameters:
message- the error messageelement- the related model element
-
ModelException
public ModelException(String message, Throwable cause)
Creates a model exception.- Parameters:
message- the error messagecause- the cause
-
ModelException
public ModelException(String message)
Creates a model exception.- Parameters:
message- the error message
-
ModelException
public ModelException(Collection<ModelError> errors)
Creates a model exception from a collection of errors.- Parameters:
errors- the errors
-
-
Method Detail
-
getElement
public ModelElement getElement()
Gets the related model element.- Returns:
- the element, may be null!
-
getMessage
public String getMessage()
- Overrides:
getMessagein classThrowable
-
isRelatedTo
public boolean isRelatedTo(ModelElement otherElement)
Returns whether given element is related to this exception.- Parameters:
otherElement- some other model element- Returns:
- true if related
-
-