Examples of TextEntryParseException


Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

            final double value = DEFAULT_NUMBER_FORMAT.parse(entry).doubleValue();
            final String currencyCode = money == null ? defaultCurrencyCode : money.getCurrency();
            money = new Money(value, currencyCode);
            return money;
        } catch (final ParseException ex) {
            throw new TextEntryParseException("Not a distinguishable money value " + entry, ex);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    private Money parseNumberAndCurrencyCode(final String amount, final String code) {
        final String currencyCode = code.toUpperCase();
        try {
            Currency.getInstance(currencyCode.toUpperCase());
        } catch (final IllegalArgumentException e) {
            throw new TextEntryParseException("Invalid currency code " + currencyCode, e);
        }
        try {
            final Money money = new Money(DEFAULT_NUMBER_FORMAT.parse(amount).doubleValue(), currencyCode);
            return money;
        } catch (final ParseException e) {
            throw new TextEntryParseException("Invalid money entry", e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    @Override
    protected Byte doParse(final Object context, final String entry) {
        try {
            return Byte.valueOf(format.parse(entry).byteValue());
        } catch (final ParseException e) {
            throw new TextEntryParseException("Not a number " + entry, e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

                return new Color(Integer.parseInt(text.substring(1), 16));
            } else {
                return new Color(Integer.parseInt(text));
            }
        } catch (final NumberFormatException e) {
            throw new TextEntryParseException("Not a number " + text, e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    @Override
    protected Long doParse(final Object context, final String entry) {
        try {
            return Long.valueOf(format.parse(entry).longValue());
        } catch (final ParseException e) {
            throw new TextEntryParseException("Not a whole number " + entry, e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    @Override
    protected BigDecimal doParse(final Object context, final String entry) {
        try {
            return new BigDecimal(entry);
        } catch (final NumberFormatException e) {
            throw new TextEntryParseException("Not an decimal " + entry, e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

        if ("true".equals(compareTo)) {
            return Boolean.TRUE;
        } else if ("false".startsWith(compareTo)) {
            return Boolean.FALSE;
        } else {
            throw new TextEntryParseException("Not a logical value " + entry);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

            return format.parse(dateString);
        } catch (final ParseException e) {
            if (elements.hasNext()) {
                return parseDate(dateString, elements);
            } else {
                throw new TextEntryParseException("Not recognised as a date: " + dateString);
            }
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    @Override
    protected Double doParse(final Object context, final String entry) {
        try {
            return new Double(format.parse(entry).doubleValue());
        } catch (final ParseException e) {
            throw new TextEntryParseException("Not floating point number " + entry, e);
        }
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException

    @Override
    protected BigInteger doParse(final Object context, final String entry) {
        try {
            return new BigInteger(entry);
        } catch (final NumberFormatException e) {
            throw new TextEntryParseException("Not an integer " + entry, e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.