public final class

Message

extends Object
implements Element Serializable
java.lang.Object
   ↳ com.google.inject.spi.Message

Class Overview

An error message and the context in which it occured. Messages are usually created internally by Guice and its extensions. Messages can be created explicitly in a module using addError() statements:

     try {
       bindPropertiesFromFile();
     } catch (IOException e) {
       addError(e);
     }

Summary

Public Constructors
Message(Object source, String message)
Message(String message)
Message(List<Object> sources, String message, Throwable cause)
Public Methods
<T> T acceptVisitor(ElementVisitor<T> visitor)
Accepts an element visitor.
void applyTo(Binder binder)
Writes this module element to the given binder (optional operation).
boolean equals(Object o)
Throwable getCause()
Returns the throwable that caused this message, or null if this message was not caused by a throwable.
String getMessage()
Gets the error message text.
String getSource()
Returns an arbitrary object containing information about the "place" where this element was configured.
List<Object> getSources()
int hashCode()
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.inject.spi.Element

Public Constructors

public Message (Object source, String message)

public Message (String message)

public Message (List<Object> sources, String message, Throwable cause)

Public Methods

public T acceptVisitor (ElementVisitor<T> visitor)

Accepts an element visitor. Invokes the visitor method specific to this element's type.

Parameters
visitor to call back on

public void applyTo (Binder binder)

Writes this module element to the given binder (optional operation).

Parameters
binder to apply configuration element to

public boolean equals (Object o)

Since: API Level

public Throwable getCause ()

Returns the throwable that caused this message, or null if this message was not caused by a throwable.

public String getMessage ()

Gets the error message text.

public String getSource ()

Returns an arbitrary object containing information about the "place" where this element was configured. Used by Guice in the production of descriptive error messages.

Tools might specially handle types they know about; StackTraceElement is a good example. Tools should simply call toString() on the source object if the type is unfamiliar.

public List<Object> getSources ()

public int hashCode ()

Since: API Level

public String toString ()

Since: API Level