Class ODataMessageException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.apache.olingo.odata2.api.exception.ODataException
-
- org.apache.olingo.odata2.api.exception.ODataMessageException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BatchException,EdmException,EntityProviderException,ExceptionVisitExpression,ODataHttpException
public abstract class ODataMessageException extends ODataException
DO NOT EXTEND THIS EXCEPTION
APPLICATION DEVELOPERS: please useODataApplicationExceptiono throw custom exceptions.Base exception class for all exceptions in the
ODatalibrary. This class extendsODataExceptionwith a message that will be displayed to a possible client and therefore needs support for internationalization.
To support internationalization and translation of messages, this class and its sub classes contain aMessageReferenceobject which can be mapped to a related key and message text in the resource bundles.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static MessageReferenceCOMMONReference to common message for aODataMessageExceptionprotected StringerrorCodeOData error codeprotected MessageReferencemessageReferenceMessage reference for exception which is used for internationalization
-
Constructor Summary
Constructors Constructor Description ODataMessageException(MessageReference messageReference)CreatesODataMessageExceptionwith givenMessageReference.ODataMessageException(MessageReference messageReference, String errorCode)CreatesODataMessageExceptionwith givenMessageReferenceand error code.ODataMessageException(MessageReference messageReference, Throwable cause)CreatesODataMessageExceptionwith givenMessageReferenceand causeThrowablewhich caused this exception.ODataMessageException(MessageReference messageReference, Throwable cause, String errorCode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static MessageReferencecreateMessageReference(Class<? extends ODataMessageException> clazz, String messageReferenceKey)CreatesMessageReferenceobjects more conveniently.StringgetErrorCode()Gets the error code for thisODataMessageException.StringgetMessage()MessageReferencegetMessageReference()Gets the relatedMessageReference.-
Methods inherited from class org.apache.olingo.odata2.api.exception.ODataException
getApplicationExceptionCause, getHttpExceptionCause, getMessageExceptionCause, isCausedByApplicationException, isCausedByHttpException, isCausedByMessageException
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
messageReference
protected final MessageReference messageReference
Message reference for exception which is used for internationalization
-
errorCode
protected final String errorCode
OData error code
-
COMMON
public static final MessageReference COMMON
Reference to common message for aODataMessageException
-
-
Constructor Detail
-
ODataMessageException
public ODataMessageException(MessageReference messageReference)
CreatesODataMessageExceptionwith givenMessageReference.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageException
-
ODataMessageException
public ODataMessageException(MessageReference messageReference, Throwable cause)
CreatesODataMessageExceptionwith givenMessageReferenceand causeThrowablewhich caused this exception.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptioncause- exception which caused this exception
-
ODataMessageException
public ODataMessageException(MessageReference messageReference, Throwable cause, String errorCode)
- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptioncause- exception which caused this exceptionerrorCode- a String with a unique code identifying this exception
-
ODataMessageException
public ODataMessageException(MessageReference messageReference, String errorCode)
CreatesODataMessageExceptionwith givenMessageReferenceand error code.- Parameters:
messageReference- references the message text (and additional values) of thisODataMessageExceptionerrorCode- a String with a unique code identifying this exception
-
-
Method Detail
-
createMessageReference
protected static final MessageReference createMessageReference(Class<? extends ODataMessageException> clazz, String messageReferenceKey)
CreatesMessageReferenceobjects more conveniently.- Parameters:
clazz- exception class for message referencemessageReferenceKey- unique (in exception class) key for message reference- Returns:
- created message-reference instance
-
getMessageReference
public MessageReference getMessageReference()
Gets the relatedMessageReference.- Returns:
- the message reference
-
getErrorCode
public String getErrorCode()
Gets the error code for thisODataMessageException. Default isnull.- Returns:
- the error code
-
getMessage
public String getMessage()
- Overrides:
getMessagein classThrowable
-
-