public static class Message.Builder extends Object
Message class. This builder has been designed due to heavy
constructor overloading with many parameters. It helps instantiating global variables of
Message.
To use the builder simply create an instance by calling the
#Message(String, Severity) or by calling one of the static creation methods like
Message.error(String), Message.warning(String) or
Message.info(String). Afterwards add needed information to the builder for example
call invalidObjects(ObjectProperty...) to provide some invalid object properties.
When the builder has every information that is needed to create a proper message call
create().
| Constructor and Description |
|---|
Message.Builder(String text,
Severity severity)
Creates a new builder that is able to create a proper
Message with all needed
information. |
| Modifier and Type | Method and Description |
|---|---|
Message.Builder |
code(String code)
Set the message's code that identifies the kind of the message.
|
Message |
create()
Creates a new
Message with all previously given properties. |
Message.Builder |
invalidObjects(List<ObjectProperty> invalidObjectProperties)
Add a list of object properties the message refers to.
|
Message.Builder |
invalidObjects(ObjectProperty... invalidObjectProperties)
Add some object properties the message refers to.
|
Message.Builder |
invalidObjects(Object object,
String... properties)
Add some object properties the message refers to by creating instances of
ObjectProperty for every given property and the given object. |
Message.Builder |
markers(IMarker... markers)
Set some markers that should be provided to the new message.
|
Message.Builder |
markers(List<IMarker> markers)
Set a list of markers that should be provided to the new message.
|
Message.Builder |
replacements(List<MsgReplacementParameter> replacementParams)
A list of replacement parameters the message should reference.
|
Message.Builder |
replacements(MsgReplacementParameter... replacementParams)
Some replacement parameters the message should reference.
|
Message.Builder |
replacements(String name,
Object value)
Creates a new
MsgReplacementParameter the message should reference |
public Message.Builder(String text, Severity severity)
Message with all needed
information.text - The human readable text of this messageseverity - The message's severity: Message.ERROR, Message.WARNING or Message.INFOpublic Message.Builder code(String code)
code - A message code that identifies the kind of the messagepublic Message.Builder invalidObjects(List<ObjectProperty> invalidObjectProperties)
invalidObjectProperties - A list of object properties the message refers topublic Message.Builder invalidObjects(ObjectProperty... invalidObjectProperties)
invalidObjectProperties - Some object properties the message refers topublic Message.Builder invalidObjects(Object object, String... properties)
ObjectProperty for every given property and the given object.object - The object the message refers toproperties - Some properties the message refers topublic Message.Builder replacements(List<MsgReplacementParameter> replacementParams)
replacementParams - a list of replacement parameterspublic Message.Builder replacements(MsgReplacementParameter... replacementParams)
replacementParams - Some replacement parameterspublic Message.Builder replacements(String name, Object value)
MsgReplacementParameter the message should referencename - The name of the MsgReplacementParametervalue - The value of the MsgReplacementParameterpublic Message.Builder markers(List<IMarker> markers)
markers - a list of markerspublic Message.Builder markers(IMarker... markers)
markers - Some markersCopyright © 2014. All rights reserved.