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
DefaultValidationResultinstance, 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.BuilderaddValidationMessage(ValidationMessage msg)Adds an object with a validation message to this instance.DefaultValidationResult.BuilderaddValidationMessages(Collection<ValidationMessage> msgs)Adds all messages stored in the given collection to this object.DefaultValidationResultbuild()Returns theDefaultValidationResultdefined by this builder.voidreset()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 theDefaultValidationResultdefined by this builder.- Returns:
- the
DefaultValidationResultcreated by this builder
-
reset
public final void reset()
Resets this builder. After that definition of a new validation result object can be started.
-
-