Java Doc for Currency.java in  » Internationalization-Localization » icu4j » com » ibm » icu » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.icu.util.MeasureUnit
      com.ibm.icu.util.Currency

All known Subclasses:   com.ibm.icu.util.CurrencyServiceShim,
Currency
public class Currency extends MeasureUnit implements Serializable(Code)
A class encapsulating a currency, as defined by ISO 4217. A Currency object can be created given a Locale or given an ISO 4217 code. Once created, the Currency object can return various data necessary to its proper display:
  • A display symbol, for a specific locale
  • The number of fraction digits to display
  • A rounding increment
The DecimalFormat class uses these data to display currencies.

Note: This class deliberately resembles java.util.Currency but it has a completely independent implementation, and adds features not present in the JDK.
author:
   Alan Liu


Inner Class :abstract static class ServiceShim

Field Summary
final public static  intLONG_NAME
     Selector for ucurr_getName indicating the long name for a currency, such as "US Dollar" for USD.
final public static  intSYMBOL_NAME
     Selector for getName() indicating a symbolic name for a currency, such as "$" for USD.

Constructor Summary
protected  Currency(String theISOCode)
     Constructs a currency object for the given ISO 4217 3-letter code.

Method Summary
static  CurrencycreateCurrency(ULocale loc)
     Instantiate a currency from a resource bundle found in Locale loc.
public  booleanequals(Object rhs)
     Return true if rhs is a Currency instance, is non-null, and has the same currency code.
public static  Locale[]getAvailableLocales()
     Return an array of the locales for which a currency is defined.
public static  ULocale[]getAvailableULocales()
     Return an array of the ulocales for which a currency is defined.
public  StringgetCurrencyCode()
     Returns the ISO 4217 3-letter code for this currency object.
public  intgetDefaultFractionDigits()
     Returns the number of the number of fraction digits that should be displayed for this currency.
public static  CurrencygetInstance(Locale locale)
     Returns a currency object for the default currency in the given locale.
public static  CurrencygetInstance(ULocale locale)
     Returns a currency object for the default currency in the given locale.
public static  CurrencygetInstance(String theISOCode)
     Returns a currency object given an ISO 4217 3-letter code.
final public  ULocalegetLocale(ULocale.Type type)
     Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation.
public  StringgetName(Locale locale, int nameStyle, boolean[] isChoiceFormat)
     Returns the display name for the given currency in the given locale.
public  StringgetName(ULocale locale, int nameStyle, boolean[] isChoiceFormat)
     Returns the display name for the given currency in the given locale.
public  doublegetRoundingIncrement()
     Returns the rounding increment for this currency, or 0.0 if no rounding is done by this currency.
public  StringgetSymbol()
     Convenience and compatibility override of getName that requests the symbol name.
public  StringgetSymbol(Locale loc)
     Convenience and compatibility override of getName that requests the symbol name.
public  StringgetSymbol(ULocale uloc)
     Convenience and compatibility override of getName that requests the symbol name.
public  inthashCode()
     Return a hashcode for this currency.
public static  Stringparse(ULocale locale, String text, ParsePosition pos)
     Attempt to parse the given string as a currency, either as a display name in the given locale, or as a 3-letter ISO 4217 code.
public static  ObjectregisterInstance(Currency currency, ULocale locale)
     Registers a new currency for the provided locale.
final  voidsetLocale(ULocale valid, ULocale actual)
     Set information about the locales that were used to create this object.
public  StringtoString()
     Returns the ISO 4217 code for this currency.
public static  booleanunregister(Object registryKey)
     Unregister the currency associated with this key (obtained from registerInstance).

Field Detail
LONG_NAME
final public static int LONG_NAME(Code)
Selector for ucurr_getName indicating the long name for a currency, such as "US Dollar" for USD.



SYMBOL_NAME
final public static int SYMBOL_NAME(Code)
Selector for getName() indicating a symbolic name for a currency, such as "$" for USD.




Constructor Detail
Currency
protected Currency(String theISOCode)(Code)
Constructs a currency object for the given ISO 4217 3-letter code. This constructor assumes that the code is valid.
Parameters:
  theISOCode - The iso code used to construct the currency.




Method Detail
createCurrency
static Currency createCurrency(ULocale loc)(Code)
Instantiate a currency from a resource bundle found in Locale loc.



equals
public boolean equals(Object rhs)(Code)
Return true if rhs is a Currency instance, is non-null, and has the same currency code.



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Return an array of the locales for which a currency is defined. an array of the available locales



getAvailableULocales
public static ULocale[] getAvailableULocales()(Code)
Return an array of the ulocales for which a currency is defined. an array of the available ulocales



getCurrencyCode
public String getCurrencyCode()(Code)
Returns the ISO 4217 3-letter code for this currency object.



getDefaultFractionDigits
public int getDefaultFractionDigits()(Code)
Returns the number of the number of fraction digits that should be displayed for this currency. a non-negative number of fraction digits to bedisplayed



getInstance
public static Currency getInstance(Locale locale)(Code)
Returns a currency object for the default currency in the given locale.
Parameters:
  locale - the locale the currency object for this locale



getInstance
public static Currency getInstance(ULocale locale)(Code)
Returns a currency object for the default currency in the given locale.



getInstance
public static Currency getInstance(String theISOCode)(Code)
Returns a currency object given an ISO 4217 3-letter code.
Parameters:
  theISOCode - the iso code the currency for this iso code



getLocale
final public ULocale getLocale(ULocale.Type type)(Code)
Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation. For example, if an object is created for locale en_US_CALIFORNIA, the actual data may be drawn from en (the actual locale), and en_US may be the most specific locale that exists (the valid locale).

Note: This method will be obsoleted. The implementation is no longer locale-specific and so there is no longer a valid or actual locale associated with the Currency object. Until it is removed, this method will return the root locale.
Parameters:
  type - type of information requested, either com.ibm.icu.util.ULocale.VALID_LOCALE or com.ibm.icu.util.ULocale.ACTUAL_LOCALE. the information specified by type, or null ifthis object was not constructed from locale data.
See Also:   com.ibm.icu.util.ULocale
See Also:   com.ibm.icu.util.ULocale.VALID_LOCALE
See Also:   com.ibm.icu.util.ULocale.ACTUAL_LOCALE




getName
public String getName(Locale locale, int nameStyle, boolean[] isChoiceFormat)(Code)
Returns the display name for the given currency in the given locale. For example, the display name for the USD currency object in the en_US locale is "$".
Parameters:
  locale - locale in which to display currency
Parameters:
  nameStyle - selector for which kind of name to return
Parameters:
  isChoiceFormat - fill-in; isChoiceFormat[0] is set to trueif the returned value is a ChoiceFormat pattern; otherwise itis set to false display string for this currency. If the resource datacontains no entry for this currency, then the ISO 4217 code isreturned. If isChoiceFormat[0] is true, then the result is aChoiceFormat pattern. Otherwise it is a static string.



getName
public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat)(Code)
Returns the display name for the given currency in the given locale. For example, the display name for the USD currency object in the en_US locale is "$".
Parameters:
  locale - locale in which to display currency
Parameters:
  nameStyle - selector for which kind of name to return
Parameters:
  isChoiceFormat - fill-in; isChoiceFormat[0] is set to trueif the returned value is a ChoiceFormat pattern; otherwise itis set to false display string for this currency. If the resource datacontains no entry for this currency, then the ISO 4217 code isreturned. If isChoiceFormat[0] is true, then the result is aChoiceFormat pattern. Otherwise it is a static string.



getRoundingIncrement
public double getRoundingIncrement()(Code)
Returns the rounding increment for this currency, or 0.0 if no rounding is done by this currency. the non-negative rounding increment, or 0.0 if none



getSymbol
public String getSymbol()(Code)
Convenience and compatibility override of getName that requests the symbol name.
See Also:   Currency.getName



getSymbol
public String getSymbol(Locale loc)(Code)
Convenience and compatibility override of getName that requests the symbol name.
Parameters:
  loc - the Locale for the symbol
See Also:   Currency.getName



getSymbol
public String getSymbol(ULocale uloc)(Code)
Convenience and compatibility override of getName that requests the symbol name.
Parameters:
  uloc - the ULocale for the symbol
See Also:   Currency.getName



hashCode
public int hashCode()(Code)
Return a hashcode for this currency.



parse
public static String parse(ULocale locale, String text, ParsePosition pos)(Code)
Attempt to parse the given string as a currency, either as a display name in the given locale, or as a 3-letter ISO 4217 code. If multiple display names match, then the longest one is selected. If both a display name and a 3-letter ISO code match, then the display name is preferred, unless it's length is less than 3.
Parameters:
  locale - the locale of the display names to match
Parameters:
  text - the text to parse
Parameters:
  pos - input-output position; on input, the position withintext to match; must have 0 <= pos.getIndex() < text.length();on output, the position after the last matched character. Ifthe parse fails, the position in unchanged upon output. the ISO 4217 code, as a string, of the best match, ornull if there is no match



registerInstance
public static Object registerInstance(Currency currency, ULocale locale)(Code)
Registers a new currency for the provided locale. The returned object is a key that can be used to unregister this currency object.
Parameters:
  currency - the currency to register
Parameters:
  locale - the ulocale under which to register the currency a registry key that can be used to unregister this currency
See Also:   Currency.unregister



setLocale
final void setLocale(ULocale valid, ULocale actual)(Code)
Set information about the locales that were used to create this object. If the object was not constructed from locale data, both arguments should be set to null. Otherwise, neither should be null. The actual locale must be at the same level or less specific than the valid locale. This method is intended for use by factories or other entities that create objects of this class.
Parameters:
  valid - the most specific locale containing any resourcedata, or null
Parameters:
  actual - the locale containing data used to construct thisobject, or null
See Also:   com.ibm.icu.util.ULocale
See Also:   com.ibm.icu.util.ULocale.VALID_LOCALE
See Also:   com.ibm.icu.util.ULocale.ACTUAL_LOCALE



toString
public String toString()(Code)
Returns the ISO 4217 code for this currency.



unregister
public static boolean unregister(Object registryKey)(Code)
Unregister the currency associated with this key (obtained from registerInstance).
Parameters:
  registryKey - the registry key returned from registerInstance
See Also:   Currency.registerInstance




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.