com.samskivert.velocity
Class CurrencyTool

java.lang.Object
  extended by com.samskivert.velocity.CurrencyTool

public class CurrencyTool
extends Object

Provides handy currency functions for use in velocity.


Field Summary
protected  Locale _locale
          The locale in which we are providing currency functionality.
 
Constructor Summary
CurrencyTool(Locale locale)
          Creates a new CurrencyTool which will used the supplied request to look up the locale with which to do currency formatting in.
 
Method Summary
 String currency(double value)
          Converts a number representing currency in the requester's locale to a display string.
 String currencyPennies(double value)
          Converts a number representing pennies to a currency display string.
 String dollars(double value)
          Converts a number representing dollars to a currency display string.
 String dollarsPennies(double value)
          Converts a number representing pennies to a displayable dollars value.
 String penniesToDollars(int pennies)
          Velocity currently doesn't support floats, so we have to provide our own support to convert pennies to a dollar amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_locale

protected Locale _locale
The locale in which we are providing currency functionality.

Constructor Detail

CurrencyTool

public CurrencyTool(Locale locale)
Creates a new CurrencyTool which will used the supplied request to look up the locale with which to do currency formatting in.

Method Detail

dollars

public String dollars(double value)
Converts a number representing dollars to a currency display string.


dollarsPennies

public String dollarsPennies(double value)
Converts a number representing pennies to a displayable dollars value.


currency

public String currency(double value)
Converts a number representing currency in the requester's locale to a display string. Note: you probably want to be using dollars(double).


currencyPennies

public String currencyPennies(double value)
Converts a number representing pennies to a currency display string. Note: you probably want to be using dollarsPennies(double).


penniesToDollars

public String penniesToDollars(int pennies)
Velocity currently doesn't support floats, so we have to provide our own support to convert pennies to a dollar amount.



Copyright © 2000-2008 Michael Bayne. All Rights Reserved.