|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.money.format.MoneyParseContext
public final class MoneyParseContext
Context used when parsing money.
This class is mutable and intended for use by a single thread. A new instance is created for each parse.
Method Summary | |
---|---|
BigDecimal |
getAmount()
Gets the parsed amount. |
CurrencyUnit |
getCurrency()
Gets the parsed currency. |
int |
getErrorIndex()
Gets the error index. |
int |
getIndex()
Gets the current parse position index. |
Locale |
getLocale()
Gets the locale. |
CharSequence |
getText()
Gets the text being parsed. |
int |
getTextLength()
Gets the length of the text being parsed. |
String |
getTextSubstring(int start,
int end)
Gets a substring of the text being parsed. |
boolean |
isComplete()
Checks if the context contains a currency and amount suitable for creating a monetary value. |
boolean |
isError()
Checks if the parse has found an error. |
boolean |
isFullyParsed()
Checks if the text has been fully parsed such that there is no more text to parse. |
void |
setAmount(BigDecimal amount)
Sets the parsed currency. |
void |
setCurrency(CurrencyUnit currency)
Sets the parsed currency. |
void |
setError()
Sets the error index from the current index. |
void |
setErrorIndex(int index)
Sets the error index. |
void |
setIndex(int index)
Sets the current parse position index. |
void |
setLocale(Locale locale)
Sets the locale. |
void |
setText(CharSequence text)
Sets the text. |
BigMoney |
toBigMoney()
Converts the context to a BigMoney . |
ParsePosition |
toParsePosition()
Converts the indexes to a parse position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Locale getLocale()
public void setLocale(Locale locale)
locale
- the locale, not nullpublic CharSequence getText()
public void setText(CharSequence text)
text
- the text being parsed, not nullpublic int getTextLength()
public String getTextSubstring(int start, int end)
start
- the start indexend
- the end index
public int getIndex()
public void setIndex(int index)
index
- the current parse position indexpublic int getErrorIndex()
public void setErrorIndex(int index)
index
- the error indexpublic void setError()
public CurrencyUnit getCurrency()
public void setCurrency(CurrencyUnit currency)
currency
- the parsed currency, may be nullpublic BigDecimal getAmount()
public void setAmount(BigDecimal amount)
amount
- the parsed amount, may be nullpublic boolean isError()
public boolean isFullyParsed()
public boolean isComplete()
public ParsePosition toParsePosition()
public BigMoney toBigMoney()
BigMoney
.
MoneyFormatException
- if either the currency or amount is missing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |