Package org.apache.sis.util

Examples of org.apache.sis.util.UnconvertibleObjectException


     * to the storage set. The {@code original} value is used only for formatting an error
     * message in case of failure.
     */
    final boolean add(final E original, final S element) {
        if (element == null) {
            throw new UnconvertibleObjectException(Errors.format(
                    Errors.Keys.IllegalArgumentValue_2, "element", original));
        }
        return storage.add(element);
    }
View Full Code Here


            return null;
        }
        try {
            return doConvert(source);
        } catch (Exception e) {
            throw new UnconvertibleObjectException(formatErrorMessage(source), e);
        }
    }
View Full Code Here

     * to the storage map. The {@code original} key is used only for formatting an error message
     * in case of failure.
     */
    final V put(final K original, final SK key, final SV value) {
        if (key == null) {
            throw new UnconvertibleObjectException(Errors.format(
                    Errors.Keys.IllegalArgumentValue_2, "key", original));
        }
        return valueConverter.apply(storage.put(key, value));
    }
View Full Code Here

     * to the storage set. The {@code original} value is used only for formatting an error
     * message in case of failure.
     */
    final boolean add(final E original, final S element) {
        if (element == null) {
            throw new UnconvertibleObjectException(Errors.format(
                    Errors.Keys.IllegalArgumentValue_2, "element", original));
        }
        return storage.add(element);
    }
View Full Code Here

        /** Converts the given string to the target type of this converter. */
        @Override T doConvert(String source) {
            final T code = Types.forCodeName(targetClass, source, false);
            if (code == null) {
                throw new UnconvertibleObjectException(formatErrorMessage(source));
            }
            return code;
        }
View Full Code Here

        final T target = Numbers.cast(source, targetClass);
        if (target.longValue() != source.longValue() ||
                Double.doubleToLongBits(target.doubleValue()) !=
                Double.doubleToLongBits(source.doubleValue()))
        {
            throw new UnconvertibleObjectException(formatErrorMessage(source));
        }
        return target;
    }
View Full Code Here

        if (candidate.getSourceClass() == sourceClass &&
            candidate.getTargetClass() == targetClass)
        {
            return (ObjectConverter<S,T>) candidate;
        }
        throw new UnconvertibleObjectException(Errors.format(Errors.Keys.CanNotConvertFromType_2, sourceClass, targetClass));
    }
View Full Code Here

                    put(key, converter);
                    return converter;
                }
            }
        }
        throw new UnconvertibleObjectException(Errors.format(Errors.Keys.CanNotConvertFromType_2, sourceClass, targetClass));
    }
View Full Code Here

        try {
            return doConvert(source);
        } catch (UnconvertibleObjectException e) {
            throw e;
        } catch (Exception e) {
            throw new UnconvertibleObjectException(formatErrorMessage(source), e);
        }
    }
View Full Code Here

        @Override java.lang.Boolean doConvert(final String source) throws UnconvertibleObjectException {
            // "String in switch" in the JDK7 branch.
            final String lower = source.toLowerCase(java.util.Locale.US);
            if (lower.equals("true"|| lower.equals("yes") || lower.equals("on"|| lower.equals("1")) return java.lang.Boolean.TRUE;
            if (lower.equals("false") || lower.equals("no"|| lower.equals("off") || lower.equals("0")) return java.lang.Boolean.FALSE;
            throw new UnconvertibleObjectException(formatErrorMessage(source));
        }
View Full Code Here

TOP

Related Classes of org.apache.sis.util.UnconvertibleObjectException

Copyright © 2018 www.massapicom. 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.