net.sf.appinfo.formatter
Class CachingApplicationInfoFormatter

java.lang.Object
  extended by net.sf.appinfo.formatter.CachingApplicationInfoFormatter
All Implemented Interfaces:
ApplicationInfoFormatter

public class CachingApplicationInfoFormatter
extends Object
implements ApplicationInfoFormatter

ApplicationInfo formatter with caching abilities. Designed to be used as a wrapper/decorator of the other ApplicationInfoFormatter implementations providing cached read of values. Wrapped formatter is used in the first request, later value is returned from local cache. When using Spring appInfoText bean could be a good alternative.

Since:
0.5.0
Author:
Marcin ZajÄ…czkowski, 2010-10-16

Constructor Summary
CachingApplicationInfoFormatter(ApplicationInfoFormatter appInfoFormatter)
           
 
Method Summary
 String getInfo()
          Returns application info in format which is able to direct use application.
 void printInfo()
          Prints application info in format given by getInfo() to the log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingApplicationInfoFormatter

public CachingApplicationInfoFormatter(ApplicationInfoFormatter appInfoFormatter)
Method Detail

getInfo

public String getInfo()
Description copied from interface: ApplicationInfoFormatter
Returns application info in format which is able to direct use application. Subclasses should determine specific format (e.g. for title bar or web footer)

Specified by:
getInfo in interface ApplicationInfoFormatter
Returns:
application info in desired format

printInfo

public void printInfo()
Description copied from interface: ApplicationInfoFormatter
Prints application info in format given by getInfo() to the log. Could be used after formatter bean creation (in PostConstruct/init) to print application version to the log.

Specified by:
printInfo in interface ApplicationInfoFormatter


Copyright © 2010-2011. All Rights Reserved.