org.apache.olingo.odata2.api.exception

## Class MessageReference

- java.lang.Object
- - org.apache.olingo.odata2.api.exception.MessageReference

-     public abstract class MessageReference
      extends Object

  APPLICATION DEVELOPERS: Please use `ODataApplicationException` to throw custom exceptions. This class is used inside the library only.

  A `MessageReference` references to the used message for an `ODataMessageException` and its sub classes. It supports internationalization and translation of exception messages.
  Theses classes contain a `MessageReference` object which can be mapped to a related key and message text in the resource bundles.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<Object>` | `content`
    `protected String` | `key`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MessageReference` | `addContent(Object... content)` Adds given content to message reference.
    `MessageReference` | `create()`
    `static MessageReference` | `create(Class<? extends ODataException> clazz, String key)` Creates a `MessageReference` for given `class` and `key`.
    `boolean` | `equals(Object obj)` `MessageReference`s are equal if their message keys have the same value.
    `List<?>` | `getContent()` Receives content for this `MessageReference`.
    `String` | `getKey()` Returns message key.
    `int` | `hashCode()`
    `MessageReference` | `updateContent(List<?> oldContent, Object... newContent)`

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

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### key

          protected final String key

    - #### content

          protected List<Object> content

  - ### Method Detail

    - #### create

          public static MessageReference create(Class<? extends ODataException> clazz,
                                                String key)

      Creates a `MessageReference` for given `class` and `key`. This combination of `class` and `key` has to be provided by a resource bundle.
      Parameters:
        `clazz` - `ODataMessageException` for which this `MessageReference` should be used
        `key` - unique key (in context of `ODataMessageException`) for reference to message text in resource bundle
      Returns:
        created `MessageReference`

    - #### create

          public MessageReference create()

    - #### getKey

          public String getKey()

      Returns message key.

    - #### addContent

          public MessageReference addContent(Object... content)

      Adds given content to message reference.

    - #### getContent

          public List<?> getContent()

      Receives content for this `MessageReference`. Beware that returned list is immutable.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      `MessageReference`s are equal if their message keys have the same value.
      Overrides:
        `equals` in class `Object`
      Returns:
        `true` if both instances are equal, otherwise `false`.

    - #### updateContent

          public MessageReference updateContent(List<?> oldContent,
                                                Object... newContent)

Copyright © 2013-2022 The Apache Software Foundation. All Rights Reserved.