org.apache.olingo.server.api

## Class ODataLibraryException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.apache.olingo.commons.api.ex.ODataException
      - - org.apache.olingo.server.api.ODataLibraryException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    DeserializerException, PreconditionException, SerializerException

      public abstract class ODataLibraryException
      extends ODataException

  Abstract superclass of all translatable server exceptions.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ODataLibraryException.MessageKey` Key for the exception text in the resource bundle.
    `static class` | `ODataLibraryException.ODataErrorMessage` Error message text and `Locale` used for it.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `DEFAULT_SERVER_BUNDLE_NAME`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ODataLibraryException(String developmentMessage, ODataLibraryException.MessageKey messageKey, String... parameters)`
    `protected` | `ODataLibraryException(String developmentMessage, Throwable cause, ODataLibraryException.MessageKey messageKey, String... parameters)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract String` | `getBundleName()` Gets the name of the `ResourceBundle` containing the exception texts.
    `String` | `getLocalizedMessage()`
    `ODataLibraryException.MessageKey` | `getMessageKey()` Gets the message key.
    `ODataLibraryException.ODataErrorMessage` | `getTranslatedMessage(Locale locale)` Gets the translated message text for a given locale (or the default locale if not available), returning the developer message text if none is found.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SERVER_BUNDLE_NAME

          protected static final String DEFAULT_SERVER_BUNDLE_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ODataLibraryException

          protected ODataLibraryException(String developmentMessage,
                                          ODataLibraryException.MessageKey messageKey,
                                          String... parameters)

    - #### ODataLibraryException

          protected ODataLibraryException(String developmentMessage,
                                          Throwable cause,
                                          ODataLibraryException.MessageKey messageKey,
                                          String... parameters)

  - ### Method Detail

    - #### getLocalizedMessage

          public String getLocalizedMessage()

      Overrides:
        `getLocalizedMessage` in class `Throwable`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Throwable`

    - #### getMessageKey

          public ODataLibraryException.MessageKey getMessageKey()

      Gets the message key.

    - #### getTranslatedMessage

          public ODataLibraryException.ODataErrorMessage getTranslatedMessage(Locale locale)

      Gets the translated message text for a given locale (or the default locale if not available), returning the developer message text if none is found.
      Parameters:
        `locale` - the preferred `Locale`
      Returns:
        the error message

    - #### getBundleName

          protected abstract String getBundleName()

      Gets the name of the `ResourceBundle` containing the exception texts.

      The key for an exception text is the concatenation of the exception-class name and the `ODataLibraryException.MessageKey`, separated by a dot.

      Returns:
        the name of the resource bundle

Copyright © 2013–2022 The Apache Software Foundation. All rights reserved.