org.apache.olingo.odata2.api.exception
Class MessageReference

java.lang.Object
  extended by 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
protected  List<Object> content
           
protected  String key
           
 
Method Summary
 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)
          MessageReferences are equal if their message keys have the same value.
 List<?> getContent()
          Receives content for this MessageReference.
 String getKey()
          Returns message key.
 int hashCode()
           
 
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)
MessageReferences are equal if their message keys have the same value.

Overrides:
equals in class Object
Returns:
true if both instances are equal, otherwise false.


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