net.sourceforge.acelogger.interpolator
Class MessageBundleInterpolator

java.lang.Object
  extended by net.sourceforge.acelogger.interpolator.MessageBundleInterpolator
All Implemented Interfaces:
TextInterpolator

public class MessageBundleInterpolator
extends Object
implements TextInterpolator

An implementation of TextInterpolator that first resolves a key in a ResourceBundle to a pattern than delegates the interpolation of this pattern to a different TextInterpolator.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Constructor Summary
MessageBundleInterpolator(ResourceBundle resolver, TextInterpolator interpolator)
          Creates a new MessageBundleInterpolator using the supplied ResourceBundle to resolve the patterns and then interpolation it with the supplied TextInterpolator.
 
Method Summary
 String interpolate(String bundleKey, Object... params)
          Resolves the supplied key to a formatting pattern using a ResourceBundle, then the resolved pattern is interpolated using another TextInterpolator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBundleInterpolator

public MessageBundleInterpolator(ResourceBundle resolver,
                                 TextInterpolator interpolator)
Creates a new MessageBundleInterpolator using the supplied ResourceBundle to resolve the patterns and then interpolation it with the supplied TextInterpolator.

Parameters:
resolver - The bundle used to resolve the patterns, using the keys in log messages.
interpolator - The interpolator used to produce the final message after resolving the pattern.
Since:
1.0.0
Method Detail

interpolate

public String interpolate(String bundleKey,
                          Object... params)
Resolves the supplied key to a formatting pattern using a ResourceBundle, then the resolved pattern is interpolated using another TextInterpolator.

Specified by:
interpolate in interface TextInterpolator
Parameters:
bundleKey - The string that will be used to locate the pattern in a ResourceBundle.
params - The parameters used to interpolate the message.
Returns:
A string containing the resolved pattern interpolated with the supplied parameters.
Since:
1.0.0
See Also:
TextInterpolator.interpolate(String, Object...)


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.