com.x1seven.hydrogen.validation
Class Messages

java.lang.Object
  extended by com.x1seven.hydrogen.validation.Messages
All Implemented Interfaces:
java.io.Serializable

public class Messages
extends java.lang.Object
implements java.io.Serializable

Collection of Message objects generated by validate() methods.

Since:
1.0.0
Version:
1.3
Author:
Brendon Matheson
See Also:
Serialized Form

Field Summary
static java.lang.String GLOBAL_MESSAGE
           The key to use for Message objects that pertain to the whole request, not just to a specific property.
 
Constructor Summary
Messages()
           
 
Method Summary
 void add(java.lang.String property, Message message)
           Adds a Message to the collection for the specified property.
 int count()
           Returns the number of messages contained by this Messages object.
 java.util.Iterator get()
           Returns an Iterator for all Message objects that were added to the collection.
 java.util.Iterator get(java.lang.String property)
           Returns an Iterator for the Message objects that relate to the specified property, or an empty Iterator if there are none.
 boolean hasMessages()
           Indicates if the Messages object has any Message objects in it.
 boolean isEmpty()
           Indicates if the Messages object is empty.
 java.util.Iterator propertyNames()
           Returns an Iterator for all the property names for which at least one Message has been registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_MESSAGE

public static final java.lang.String GLOBAL_MESSAGE

The key to use for Message objects that pertain to the whole request, not just to a specific property.

See Also:
Constant Field Values
Constructor Detail

Messages

public Messages()
Method Detail

add

public void add(java.lang.String property,
                Message message)

Adds a Message to the collection for the specified property.

Parameters:
property - the property name against which the Message should be stored
message - the Message to register

propertyNames

public java.util.Iterator propertyNames()

Returns an Iterator for all the property names for which at least one Message has been registered.

Returns:
an Iterator for all the property names for which at least one Message has been registered

get

public java.util.Iterator get()

Returns an Iterator for all Message objects that were added to the collection.

Returns:
an Iterator for all Message objects that were added to the collection

get

public java.util.Iterator get(java.lang.String property)

Returns an Iterator for the Message objects that relate to the specified property, or an empty Iterator if there are none.

Parameters:
property - the property to retrieve Message objects for
Returns:
an Iterator of Message objects for the specified property, or an empty Iterator of there are no Message objects for the specified property.

count

public int count()

Returns the number of messages contained by this Messages object.

Returns:
the number of Message objects in the Messages object held by this ValidationException

hasMessages

public boolean hasMessages()

Indicates if the Messages object has any Message objects in it.

Returns:
true if the Messages object has any Message objects in it

isEmpty

public boolean isEmpty()

Indicates if the Messages object is empty.

Returns:
true if the Messages object is empty