org.loom.i18n
Class DefaultMissingMessageHandler

java.lang.Object
  extended by org.loom.i18n.DefaultMissingMessageHandler
All Implemented Interfaces:
MissingMessageHandler

@Singleton
public class DefaultMissingMessageHandler
extends java.lang.Object
implements MissingMessageHandler

This message handler logs a list of missing keys, to make them easier to add later. The recommended behavior is to configure your log system to redirect this class output to a separate file, such as ${java.io.temp}/missing.properties. Each missing key will just be written once


Constructor Summary
DefaultMissingMessageHandler()
           
 
Method Summary
 java.lang.String handleMessageError(java.lang.String messageKey, java.lang.Throwable error)
          Decides what to do with missing/malformed message keys
 java.lang.String handleMissingKey(java.lang.String missingKey)
          Decides what to do with missing keys
 java.lang.String handleMissingParameter(java.lang.String missingParamName)
          Decides what to do with missing parameters
protected  void logMissingKey(java.lang.String missingKey)
          Adds a missing key to the missing key respository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMissingMessageHandler

public DefaultMissingMessageHandler()
Method Detail

handleMissingParameter

public java.lang.String handleMissingParameter(java.lang.String missingParamName)
Description copied from interface: MissingMessageHandler
Decides what to do with missing parameters

Specified by:
handleMissingParameter in interface MissingMessageHandler
Parameters:
missingParamName - the param that could not be found (nor any substring of it)
Returns:
The substitution value. Could also decide to throw an exception instead

handleMissingKey

public java.lang.String handleMissingKey(java.lang.String missingKey)
Description copied from interface: MissingMessageHandler
Decides what to do with missing keys

Specified by:
handleMissingKey in interface MissingMessageHandler
Parameters:
missingKey - the key that could not be found
Returns:
The substitution value. Could also decide to throw an exception instead

logMissingKey

protected void logMissingKey(java.lang.String missingKey)
Adds a missing key to the missing key respository

Parameters:
missingKey -

handleMessageError

public java.lang.String handleMessageError(java.lang.String messageKey,
                                           java.lang.Throwable error)
Description copied from interface: MissingMessageHandler
Decides what to do with missing/malformed message keys

Specified by:
handleMessageError in interface MissingMessageHandler
Parameters:
messageKey - the key of the message that is missing/malformed
Returns:
The substitution value. Could also decide to throw an exception isntead of returning anything