net.sf.mmm.util.nls.impl.formatter
Class NlsFormatterType

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.nls.base.AbstractNlsFormatter<O>
              extended by net.sf.mmm.util.nls.base.AbstractNlsFormatterPlugin<Object>
                  extended by net.sf.mmm.util.nls.impl.formatter.NlsFormatterType
All Implemented Interfaces:
NlsFormatter<Object>, NlsFormatterPlugin<Object>
Direct Known Subclasses:
NlsFormatterTypeFull, NlsFormatterTypeLong, NlsFormatterTypeMedium, NlsFormatterTypeShort

public class NlsFormatterType
extends AbstractNlsFormatterPlugin<Object>

This is an implementation of NlsFormatter that formats Types.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Nested Class Summary
private  class NlsFormatterType.ClassFormatter
          This inner class is used to format Classes.
 
Field Summary
private static Package PACKAGE_JAVA_LANG
          The package java.lang.
private  ReflectionUtil reflectionUtil
           
private  String style
           
 
Constructor Summary
NlsFormatterType(String style)
          The constructor.
 
Method Summary
protected  void doInitialize()
          This method performs the actual initialization.
 void format(Object object, Locale locale, Map<String,Object> arguments, NlsTemplateResolver resolver, Appendable buffer)
          This method formats the given object according to the given locale.
protected  ReflectionUtil getReflectionUtil()
           
 String getStyle()
          This method gets the style of this formatter.
 String getType()
          This method gets the type of this formatter.
 void setReflectionUtil(ReflectionUtil reflectionUtil)
           
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsFormatterPlugin
toString
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsFormatter
format
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.nls.api.NlsFormatter
format
 

Field Detail

PACKAGE_JAVA_LANG

private static final Package PACKAGE_JAVA_LANG
The package java.lang.


style

private final String style
See Also:
getStyle()

reflectionUtil

private ReflectionUtil reflectionUtil
See Also:
getReflectionUtil()
Constructor Detail

NlsFormatterType

public NlsFormatterType(String style)
The constructor.

Parameters:
style - is the style.
Method Detail

getStyle

public String getStyle()
This method gets the style of this formatter. See STYLE_* constants of NlsFormatterManager e.g. NlsFormatterManager.STYLE_LONG.

Returns:
the style or null for no style.

getType

public String getType()
This method gets the type of this formatter. See TYPE_* constants of NlsFormatterManager e.g. NlsFormatterManager.TYPE_NUMBER.

Returns:
the type or null for the default formatter. If type is null then also style needs to be null.

getReflectionUtil

protected ReflectionUtil getReflectionUtil()
Returns:
the reflectionUtil

setReflectionUtil

@Inject
public void setReflectionUtil(ReflectionUtil reflectionUtil)
Parameters:
reflectionUtil - is the reflectionUtil to set

doInitialize

protected void doInitialize()
This method performs the actual initialization. It is called when AbstractComponent.initialize() is invoked for the first time.
ATTENTION:
When you override this method from a sub-class you need to do a super.AbstractComponent.doInitialize().

Overrides:
doInitialize in class AbstractLoggableComponent

format

public void format(Object object,
                   Locale locale,
                   Map<String,Object> arguments,
                   NlsTemplateResolver resolver,
                   Appendable buffer)
            throws IOException
This method formats the given object according to the given locale.

Parameters:
object - is the object to format.
locale - is the locale used for localized formatting.
arguments - is the Map of arguments.
resolver - is the NlsTemplateResolver.
buffer - is where to append the formatted object.
Throws:
IOException - if the given Appendable caused such exception.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.