Examples of TextEntryParseException


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

    @Override
    protected Short doParse(final Object context, final String entry) {
        try {
            return Short.valueOf(format.parse(entry).shortValue());
        } 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

    @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 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

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

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

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

            return new Percentage(new Float(format.parse(text).floatValue()));
        } catch (final ParseException e) {
            try {
                return new Percentage(asFloat(text));
            } catch (final ParseException ee) {
                throw new TextEntryParseException("Not a number " + text, ee);
            }
        }
    }
View Full Code Here

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

                return formatter.parseLocalDate(dateStr);
            } catch (final IllegalArgumentException e) {
                // continue to next
            }
        }
        throw new TextEntryParseException("Not recognised as a date: " + dateStr);
    }
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
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.