Package net.sf.jguiraffe.transform
Class DefaultValidationResult.Builder
- java.lang.Object
-
- net.sf.jguiraffe.transform.DefaultValidationResult.Builder
-
- Enclosing class:
- DefaultValidationResult
public static class DefaultValidationResult.Builder extends Object
A builder class for creating instances of
DefaultValidationResult
.In order to create a new
DefaultValidationResult
instance, create a builder, call itsaddErrorMessage()
methods, and finally invoke thebuild()
method. This can look as follows:DefaultValidationResult vres = new DefaultValidationResult.Builder() .addErrorMessage(msg1).addErrorMessage(msg2).build();
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a new instance ofBuilder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultValidationResult.Builder
addValidationMessage(ValidationMessage msg)
Adds an object with a validation message to this instance.DefaultValidationResult.Builder
addValidationMessages(Collection<ValidationMessage> msgs)
Adds all messages stored in the given collection to this object.DefaultValidationResult
build()
Returns theDefaultValidationResult
defined by this builder.void
reset()
Resets this builder.
-
-
-
Method Detail
-
addValidationMessage
public DefaultValidationResult.Builder addValidationMessage(ValidationMessage msg)
Adds an object with a validation message to this instance. If the message has the levelERROR
, this also means that the validation failed.- Parameters:
msg
- the message object (must not be null)- Returns:
- a reference to this builder
- Throws:
IllegalArgumentException
- if the message is null
-
addValidationMessages
public DefaultValidationResult.Builder addValidationMessages(Collection<ValidationMessage> msgs)
Adds all messages stored in the given collection to this object.- Parameters:
msgs
- the collection with the messages to add (must not be null)- Returns:
- a reference to this builder
- Throws:
IllegalArgumentException
- if the collection with the messages is null or one of its elements is null
-
build
public DefaultValidationResult build()
Returns theDefaultValidationResult
defined by this builder.- Returns:
- the
DefaultValidationResult
created by this builder
-
reset
public final void reset()
Resets this builder. After that definition of a new validation result object can be started.
-
-