org.marketcetera.util.l10n
Class MessageComparator

java.lang.Object
  extended by org.marketcetera.util.l10n.MessageComparator

public class MessageComparator
extends Object

A comparator of two message meta-information holders.

Since:
0.6.0
Version:
$Id: MessageComparator.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Constructor Summary
MessageComparator(Class<?> container)
          Creates a new comparator for the given container class and the fallback properties file deduced from the class's message provider.
MessageComparator(Class<?> container, Locale locale)
          Creates a new comparator for the given container class and the properties file deduced from the class's message provider and the given locale.
MessageComparator(ContainerClassInfo classInfo)
          Creates a new comparator for the given container class meta-information and the properties file deduced from the container's message provider.
MessageComparator(List<MessageInfo> srcInfo, List<MessageInfo> dstInfo)
          Creates a new comparator for the given meta-information.
MessageComparator(MessageInfoProvider srcProvider, MessageInfoProvider dstProvider)
          Creates a new comparator for the given meta-information providers.
 
Method Summary
 String getDifferences()
          Returns a textual form of the differences between source and destination.
 MessageInfo[] getExtraDstInfo()
          Returns the receiver's list of destination meta-information that is absent from the source.
 MessageInfo[] getExtraSrcInfo()
          Returns the receiver's list of source meta-information that is absent from the destination.
 MessageInfoPair[] getMismatches()
          Returns the receiver's mismatches.
 boolean isMatch()
          Checks whether the receiver found no differences between source and destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageComparator

public MessageComparator(List<MessageInfo> srcInfo,
                         List<MessageInfo> dstInfo)
Creates a new comparator for the given meta-information. For both parameters, the order of list elements is unimportant.

Parameters:
srcInfo - The source meta-information.
dstInfo - The destination meta-information.

MessageComparator

public MessageComparator(MessageInfoProvider srcProvider,
                         MessageInfoProvider dstProvider)
Creates a new comparator for the given meta-information providers.

Parameters:
srcProvider - The source meta-information provider.
dstProvider - The destination meta-information provider.

MessageComparator

public MessageComparator(ContainerClassInfo classInfo)
                  throws I18NException
Creates a new comparator for the given container class meta-information and the properties file deduced from the container's message provider.

Parameters:
classInfo - The meta-information of a container class.
Throws:
I18NException - Thrown if there is a problem obtaining the meta-information of the properties file.

MessageComparator

public MessageComparator(Class<?> container,
                         Locale locale)
                  throws I18NException
Creates a new comparator for the given container class and the properties file deduced from the class's message provider and the given locale.

Parameters:
container - The class.
locale - The locale. Use Locale.ROOT for the fallback properties file.
Throws:
I18NException - Thrown if there is a problem obtaining the meta-information of either the container or the properties file.

MessageComparator

public MessageComparator(Class<?> container)
                  throws I18NException
Creates a new comparator for the given container class and the fallback properties file deduced from the class's message provider.

Parameters:
container - The class.
Throws:
I18NException - Thrown if there is a problem obtaining the meta-information of either the container or the properties file.
Method Detail

getMismatches

public MessageInfoPair[] getMismatches()
Returns the receiver's mismatches. A mismatch occurs when two message keys are present in both source and destination, and both have known but different parameter counts.

Returns:
The mismatches.

getExtraSrcInfo

public MessageInfo[] getExtraSrcInfo()
Returns the receiver's list of source meta-information that is absent from the destination.

Returns:
The list.

getExtraDstInfo

public MessageInfo[] getExtraDstInfo()
Returns the receiver's list of destination meta-information that is absent from the source.

Returns:
The list.

isMatch

public boolean isMatch()
Checks whether the receiver found no differences between source and destination.

Returns:
True if so.

getDifferences

public String getDifferences()
Returns a textual form of the differences between source and destination.

Returns:
The differences. This is the empty string if there are no differences.


Copyright © 2012. All Rights Reserved.