com.novell.xsl.number
Class RomanNumberFormatter

java.lang.Object
  extended bycom.novell.xsl.number.RomanNumberFormatter
All Implemented Interfaces:
NumberFormatter

public class RomanNumberFormatter
extends Object
implements NumberFormatter

A class that formats integers into Roman numerals. This class corresponds to the xsl:number format tokens i and I.


Constructor Summary
RomanNumberFormatter(boolean useLowerCase)
          Constructs a Roman number formatter.
 
Method Summary
 String format(int value)
          Formats the specified positive integer value into a Roman numeral.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RomanNumberFormatter

public RomanNumberFormatter(boolean useLowerCase)
Constructs a Roman number formatter.

For example, the number formatter created by new RomanNumberFormatter(true) corresponds to the format token i. It generates the sequence i ii iii iv v vi vii viii ix x ....

Parameters:
useLowerCase - true if the Roman numerals should be lower case letters, false if they should be upper case letters
Method Detail

format

public String format(int value)
              throws IllegalArgumentException
Formats the specified positive integer value into a Roman numeral. If the value is greater than 3999, it is simply converted to a decimal string via Integer.toString.

Specified by:
format in interface NumberFormatter
Parameters:
value - the value to be formatted; must be greater than zero
Returns:
the formatted value
Throws:
IllegalArgumentException - if the value is less than or equal to zero