code: public MonetaryAmount parse(CharSequence text)
              throws MonetaryParseException {
          ParseContext ctx = new ParseContext(text);
          try {
              for (FormatToken token : this.positiveTokens) {
                  token.parse(ctx);
              }
          } catch (Exception e) {
              // try parsing negative...
              Logger log = Logger.getLogger(getClass().getName());
              if (log.isLoggable(Level.FINEST)) {
                  log.log(Level.FINEST,
                          "Failed to parse positive pattern, trying negative for: "
                                  + text, e);
              }
              for (FormatToken token : this.negativeTokens) {
                  token.parse(ctx);
              }
          }
          CurrencyUnit unit = ctx.getParsedCurrency();
          Number num = ctx.getParsedNumber();
          if (unit==null) {
              unit = this.amountFormatContext.get(CurrencyUnit.class);
          }
          if (num==null) {
              throw new MonetaryParseException(text.toString(), -1);
          }
          MonetaryAmountFactory<?> factory = this.amountFormatContext.getParseFactory();
          if (factory == null) {
              factory = Monetary.getDefaultAmountFactory();
          }
          return factory.setCurrency(unit).setNumber(num).create();
      }
docs: Fully parses the text into an instance of {@code MonetaryAmount}.
  
  The parse must complete normally and parse the entire text. If the parse
  completes without reading the entire length of the text, an exception is
  thrown. If any other problem occurs during parsing, an exception is
  thrown.
  
  @param text the text to parse, not null
  @return the parsed value, never {@code null}
  @throws UnsupportedOperationException             if the formatter is unable to parse
  @throws javax.money.format.MonetaryParseException if there is a problem while parsing