Examples of ValueConversionException


Examples of com.volantis.xml.expression.ValueConversionException

                    createIntValue(((Integer)object).intValue());
        } else if (object instanceof Double) {
            result = factory.
                    createDoubleValue(((Double)object).doubleValue());
        } else {
            throw new ValueConversionException(
                    "Expression evaluates to an unrecognized type (" +
                    object.getClass().getName() + ")");
        }

        return result;
View Full Code Here

Examples of com.volantis.xml.expression.ValueConversionException

                        // Leverage the conversion supporting method in the
                        // associated {@link JXPathExpression} class
                        params[i] = JXPathExpression.asValue(factory,
                                                             parameters[i]);
                    } catch (ExpressionException e) {
                        throw new ValueConversionException(
                                "Cannot convert parameter " + i,
                                e);
                    }
                } else {
                    throw new NullPointerException(
View Full Code Here

Examples of joptsimple.ValueConversionException

    private static class StringPairConverter implements ValueConverter<Pair<String, String>> {
        @Override
        public Pair<String, String> convert(String input) {
            int eqPos = input.indexOf('=');
            if (eqPos == -1) {
                throw new ValueConversionException("Parameter should be in the form key=value, which the " +
                        "following is not: '" + input + "'.");
            }
            String key = input.substring(0, eqPos).trim();
            String value = input.substring(eqPos + 1).trim();
            return Pair.newPair(key, value);
View Full Code Here

Examples of joptsimple.ValueConversionException

        @Override
        public T convert(String input) {
            try {
                return Enum.valueOf(enumClass, input.toUpperCase());
            } catch (IllegalArgumentException e) {
                throw new ValueConversionException("Unrecognized value for enum " + enumClass.getSimpleName()
                        + ": '" + input + "'.");
            }
        }
View Full Code Here

Examples of joptsimple.ValueConversionException

    public Date convert( String value ) {
        ParsePosition position = new ParsePosition( 0 );

        Date date = formatter.parse( value, position );
        if ( position.getIndex() != value.length() )
            throw new ValueConversionException( message( value ) );

        return date;
    }
View Full Code Here

Examples of joptsimple.ValueConversionException

    private void raiseValueConversionFailure( String value ) {
        ResourceBundle bundle = ResourceBundle.getBundle( "joptsimple.ExceptionMessages" );
        String template = bundle.getString( getClass().getName() + ".message" );
        String message = new MessageFormat( template ).format( new Object[] { value, pattern.pattern() } );
        throw new ValueConversionException( message );
    }
View Full Code Here

Examples of joptsimple.ValueConversionException

public class InetAddressConverter implements ValueConverter<InetAddress> {
    public InetAddress convert( String value ) {
        try {
            return InetAddress.getByName( value );
        } catch ( UnknownHostException e ) {
            throw new ValueConversionException( "Cannot convert value [" + value + " into an InetAddress", e );
        }
    }
View Full Code Here

Examples of joptsimple.ValueConversionException

        } else if (value.equals(LEVEL_TRACE)) {
            return Level.TRACE;
        } else if (value.equals(LEVEL_ALL)) {
            return Level.ALL;
        } else {
            throw new ValueConversionException("No valid log level: " + value);
        }

    }
View Full Code Here

Examples of joptsimple.ValueConversionException

    @SuppressWarnings("unchecked")
    public Class<? extends IExternalConverter> convert(String value) {
        try {
            return (Class<? extends IExternalConverter>) Class.forName(value);
        } catch (ClassNotFoundException e) {
            throw new ValueConversionException("Not a class name or not on class path: " + value);
        }
    }
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.