org.apache.myfaces.extensions.cdi.message.api
Interface Formatter<T>

All Superinterfaces:
Serializable

public interface Formatter<T>
extends Serializable

usually a formatter is responsible for one type and allows to format this type as string

Author:
Gerhard Petracek, Manfred Geiler

Method Summary
 String format(MessageContext messageContext, T valueToFormat)
          formats the given instance as string
 boolean isResponsibleFor(Class<?> type)
          answers the question if the instance is able to format an object of the given type
 boolean isStateless()
           
 

Method Detail

isResponsibleFor

boolean isResponsibleFor(Class<?> type)
answers the question if the instance is able to format an object of the given type

Parameters:
type - the type of the instance which has to be formatted
Returns:
true to signal that the formatter is responsible for formatting the given type

isStateless

boolean isStateless()
Returns:
true if it is allowed to cache the instance of the formatter

format

String format(MessageContext messageContext,
              T valueToFormat)
formats the given instance as string

Parameters:
messageContext - current message context
valueToFormat - an instance which should be formatted
Returns:
the formatted result as string


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.