Package org.faktorips.runtime
Class Message.Builder
java.lang.Object
org.faktorips.runtime.Message.Builder
- Enclosing class:
- Message
A builder for the
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 invalidObjectWithProperties(Object object, String...properties) to provide
some invalid object properties. When the builder has every information that is needed to
create a proper message call create().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the message's code that identifies the kind of the message.create()Creates a newMessagewith all previously given properties.invalidObject(ObjectProperty invalidObjectProperty) Add an object property that the message refers to.invalidObjects(List<ObjectProperty> invalidObjectProperties) Add a list of object properties that the message refers to.invalidObjects(ObjectProperty... invalidObjectProperties) Add object properties that the message refers to.invalidObjectWithProperties(Object object, String... properties) Add some object properties the message refers to by creating instances ofObjectPropertyfor every given property and the given object.markers(Collection<? extends IMarker> markers) Set a collection of markers that should be provided to the new message.Set some markers that should be provided to the new message.replacements(String name, Object value) Creates a newMsgReplacementParameterthe message should referencereplacements(List<MsgReplacementParameter> replacementParams) A list of replacement parameters the message should reference.replacements(MsgReplacementParameter... replacementParams) Some replacement parameters the message should reference.Set the message's text which is human readable.
-
Constructor Details
-
Builder
Creates a new builder that is able to create a properMessagewith all needed information.- Parameters:
text- The human readable text of this messageseverity- The message's severity:Message.ERROR,Message.WARNINGorMessage.INFO
-
Builder
- Parameters:
message- theMessageto copy
-
-
Method Details
-
code
Set the message's code that identifies the kind of the message.- Parameters:
code- A message code that identifies the kind of the message- Returns:
- This builder instance to directly add further properties
-
text
Set the message's text which is human readable.- Parameters:
text- The human readable text of this message- Returns:
- This builder instance to directly add further properties
-
severity
- Parameters:
severity- Severity of the message:Message.ERROR,Message.WARNINGorMessage.INFO- Returns:
- This builder instance to directly add further properties
-
invalidObjects
Add a list of object properties that the message refers to.- Parameters:
invalidObjectProperties- A list of object properties that the message refers to- Returns:
- This builder instance to directly add further properties
-
invalidObject
Add an object property that the message refers to.- Parameters:
invalidObjectProperty- An object property that the message refers to- Returns:
- This builder instance to directly add further properties
-
invalidObjects
Add object properties that the message refers to.- Parameters:
invalidObjectProperties- Object properties that the message refers to- Returns:
- This builder instance to directly add further properties
-
invalidObjectWithProperties
Add some object properties the message refers to by creating instances ofObjectPropertyfor every given property and the given object.- Parameters:
object- The object the message refers toproperties- Some properties the message refers to- Returns:
- This builder instance to directly add further properties
-
replacements
A list of replacement parameters the message should reference.- Parameters:
replacementParams- a list of replacement parameters- Returns:
- This builder instance to directly add further properties
-
replacements
Some replacement parameters the message should reference.- Parameters:
replacementParams- Some replacement parameters- Returns:
- This builder instance to directly add further properties
-
replacements
Creates a newMsgReplacementParameterthe message should reference- Parameters:
name- The name of theMsgReplacementParametervalue- The value of theMsgReplacementParameter- Returns:
- This builder instance to directly add further properties
-
markers
Set a collection of markers that should be provided to the new message.- Parameters:
markers- a set of markers- Returns:
- This builder instance to directly add further properties
-
markers
Set some markers that should be provided to the new message.- Parameters:
markers- Some markers- Returns:
- This builder instance to directly add further properties
-
create
Creates a newMessagewith all previously given properties.- Returns:
- A new message that has the parameters of this builder.
-