to.etc.domui.converter
Class PercentageDoubleConverter

java.lang.Object
  extended by to.etc.domui.converter.PercentageDoubleConverter
All Implemented Interfaces:
IConverter<java.lang.Double>, IObjectToStringConverter<java.lang.Double>, IStringToObjectConverter<java.lang.Double>

public class PercentageDoubleConverter
extends java.lang.Object
implements IConverter<java.lang.Double>

This converts a Double containing a percentage amount to a full representation including percentage sign.

Author:
Vladimir Mijic Created on Avg 11, 2009

Constructor Summary
PercentageDoubleConverter()
           
 
Method Summary
 java.lang.String convertObjectToString(java.util.Locale loc, java.lang.Double in)
           
 java.lang.Double convertStringToObject(java.util.Locale loc, java.lang.String in)
          Does a conversion of an percentage amount to a double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PercentageDoubleConverter

public PercentageDoubleConverter()
Method Detail

convertObjectToString

public java.lang.String convertObjectToString(java.util.Locale loc,
                                              java.lang.Double in)
                                       throws UIException
Specified by:
convertObjectToString in interface IObjectToStringConverter<java.lang.Double>
Throws:
UIException

convertStringToObject

public java.lang.Double convertStringToObject(java.util.Locale loc,
                                              java.lang.String in)
                                       throws UIException
Does a conversion of an percentage amount to a double. The input can contain percentage value with or without trailing percentage sign. Input value must be between 0 and 100 including. Input value is rounded to two decimal spaces.

Specified by:
convertStringToObject in interface IStringToObjectConverter<java.lang.Double>
Throws:
UIException
See Also:
IStringToObjectConverter.convertStringToObject(java.util.Locale, java.lang.String)