public final class Message extends java.lang.Object implements java.io.Serializable, Element
addError()
statements:
try { bindPropertiesFromFile(); } catch (IOException e) { addError(e); }
Modifier and Type | Field and Description |
---|---|
private ErrorDetail<?> |
errorDetail |
private ErrorId |
errorId |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
Message(ErrorId errorId,
ErrorDetail<?> errorDetail) |
|
Message(ErrorId errorId,
java.util.List<java.lang.Object> sources,
java.lang.String message,
java.lang.Throwable cause) |
|
Message(GuiceInternal internalOnly,
ErrorId errorId,
ErrorDetail<?> errorDetail) |
|
Message(java.util.List<java.lang.Object> sources,
java.lang.String message,
java.lang.Throwable cause) |
|
Message(java.lang.Object source,
java.lang.String message) |
|
Message(java.lang.String message) |
|
Message(java.lang.String message,
java.lang.Throwable cause) |
Modifier and Type | Method and Description |
---|---|
<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(java.lang.Object o) |
java.lang.Throwable |
getCause()
Returns the throwable that caused this message, or
null if this message was not caused
by a throwable. |
ErrorDetail<?> |
getErrorDetail()
Returns details about this error message.
|
java.lang.String |
getMessage()
Gets the error message text.
|
java.lang.String |
getSource()
Returns an arbitrary object containing information about the "place" where this element was
configured.
|
java.util.List<java.lang.Object> |
getSources() |
int |
hashCode() |
java.lang.String |
toString() |
Message |
withSource(java.util.List<java.lang.Object> newSources)
Returns a copy of this
Message with its sources replaced. |
private java.lang.Object |
writeReplace()
When serialized, we convert the error detail to a
GenericErrorDetail with string
sources. |
private final ErrorId errorId
private final ErrorDetail<?> errorDetail
private static final long serialVersionUID
public Message(GuiceInternal internalOnly, ErrorId errorId, ErrorDetail<?> errorDetail)
private Message(ErrorId errorId, ErrorDetail<?> errorDetail)
public Message(ErrorId errorId, java.util.List<java.lang.Object> sources, java.lang.String message, java.lang.Throwable cause)
public Message(java.util.List<java.lang.Object> sources, java.lang.String message, java.lang.Throwable cause)
public Message(java.lang.String message, java.lang.Throwable cause)
public Message(java.lang.Object source, java.lang.String message)
public Message(java.lang.String message)
public ErrorDetail<?> getErrorDetail()
public java.lang.String getSource()
Element
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 java.util.List<java.lang.Object> getSources()
public java.lang.String getMessage()
public <T> T acceptVisitor(ElementVisitor<T> visitor)
Element
acceptVisitor
in interface Element
visitor
- to call back onpublic java.lang.Throwable getCause()
null
if this message was not caused
by a throwable.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void applyTo(Binder binder)
Element
public Message withSource(java.util.List<java.lang.Object> newSources)
Message
with its sources replaced.private java.lang.Object writeReplace() throws java.io.ObjectStreamException
GenericErrorDetail
with string
sources. This hurts our formatting, but it guarantees that the receiving end will be able to
read the message.java.io.ObjectStreamException