org.jbind.message
Class CompositeMessage

java.lang.Object
  extended byorg.jbind.message.AbstractMessage
      extended byorg.jbind.message.CompositeMessage
All Implemented Interfaces:
ICompositeMessage, IMessage
Direct Known Subclasses:
ConstraintViolations

public class CompositeMessage
extends AbstractMessage
implements ICompositeMessage


Constructor Summary
CompositeMessage(MessageFormats aMessageFormats, java.lang.String aKey, java.lang.Object aParameters)
           
 
Method Summary
 void add(IMessage aMessage)
           
 void addTo(ICompositeMessage aCompositeMessage)
          Adds this message as a sub message to the specified composite message.
protected  java.lang.Object getParameters(java.util.Locale aLocale)
           
 boolean isComposite()
          Indicates if the message is a composite message.
 boolean isEmpty()
          Checks for emptiness.
 java.util.Iterator iterSimpleMessages()
          Iterates all simple messages contained in the message.
 java.util.Iterator iterSubMessages()
          Iterates the sub-messages of this message.
 java.lang.String output(java.util.Locale aLocale, boolean anIndent, boolean anOutputContainerLines)
          Outputs this message and all of its sub-messages.
 
Methods inherited from class org.jbind.message.AbstractMessage
getOrigin, output, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jbind.message.IMessage
getOrigin, output
 

Constructor Detail

CompositeMessage

public CompositeMessage(MessageFormats aMessageFormats,
                        java.lang.String aKey,
                        java.lang.Object aParameters)
Method Detail

getParameters

protected java.lang.Object getParameters(java.util.Locale aLocale)
Specified by:
getParameters in class AbstractMessage

isEmpty

public boolean isEmpty()
Description copied from interface: IMessage
Checks for emptiness. Simple messages are always non-empty whereas a composite message is non-empty iff it contains a non-empty sub-message.

Specified by:
isEmpty in interface IMessage
Returns:
Returns true iff this message is empty.

isComposite

public boolean isComposite()
Description copied from interface: IMessage
Indicates if the message is a composite message.

Specified by:
isComposite in interface IMessage
Returns:
Returns true iff the message is a composite message.

iterSubMessages

public java.util.Iterator iterSubMessages()
Description copied from interface: IMessage
Iterates the sub-messages of this message. Simple messages always return an empty iterator.

Specified by:
iterSubMessages in interface IMessage
Returns:
(required).

iterSimpleMessages

public java.util.Iterator iterSimpleMessages()
Description copied from interface: IMessage
Iterates all simple messages contained in the message.

Specified by:
iterSimpleMessages in interface IMessage
Returns:
(required). An iterator of IMessage.

output

public java.lang.String output(java.util.Locale aLocale,
                               boolean anIndent,
                               boolean anOutputContainerLines)
Description copied from interface: IMessage
Outputs this message and all of its sub-messages.

Best efforts are undertaken that the message is output using the specified locale. However, if the message can not be output using the specified locale then another locale is used.

Specified by:
output in interface IMessage
Overrides:
output in class AbstractMessage

add

public void add(IMessage aMessage)
Specified by:
add in interface ICompositeMessage

addTo

public void addTo(ICompositeMessage aCompositeMessage)
Description copied from interface: IMessage
Adds this message as a sub message to the specified composite message. If this message is a composite message then it recursively adds its submessages using this method again. No entry is added for a composite message itself.

Specified by:
addTo in interface IMessage
Parameters:
aCompositeMessage - (required). The composite messages to which sub messages are added.