public final class MoneyParseContext
extends java.lang.Object
This class is mutable and intended for use by a single thread. A new instance is created for each parse.
| Modifier and Type | Method | Description |
|---|---|---|
java.math.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.
|
java.util.Locale |
getLocale() |
Gets the locale.
|
java.lang.CharSequence |
getText() |
Gets the text being parsed.
|
int |
getTextLength() |
Gets the length of the text being parsed.
|
java.lang.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(java.math.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(java.util.Locale locale) |
Sets the locale.
|
void |
setText(java.lang.CharSequence text) |
Sets the text.
|
BigMoney |
toBigMoney() |
Converts the context to a
BigMoney. |
java.text.ParsePosition |
toParsePosition() |
Converts the indexes to a parse position.
|
public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale - the locale, not nullpublic java.lang.CharSequence getText()
public void setText(java.lang.CharSequence text)
text - the text being parsed, not nullpublic int getTextLength()
public java.lang.String getTextSubstring(int start,
int end)
start - the start indexend - the end indexpublic 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 java.math.BigDecimal getAmount()
public void setAmount(java.math.BigDecimal amount)
amount - the parsed amount, may be nullpublic boolean isError()
public boolean isFullyParsed()
public boolean isComplete()
public java.text.ParsePosition toParsePosition()
public BigMoney toBigMoney()
BigMoney.MoneyFormatException - if either the currency or amount is missingCopyright © 2009–2018 Joda.org. All rights reserved.