Package org.apache.camel

Examples of org.apache.camel.NoTypeConversionAvailableException


        CamelContext camelContext = exchange.getContext();
        TypeConverter converter = camelContext.getTypeConverter();
        if (converter != null) {
            return converter.mandatoryConvertTo(type, exchange, value);
        }
        throw new NoTypeConversionAvailableException(value, type);
    }
View Full Code Here


                    }
                }

                if (source == null) {
                    // indicate it was not possible to convert to a Source type
                    throw new NoTypeConversionAvailableException(body, Source.class);
                }
            }
            DocumentInfo doc = getStaticQueryContext().buildDocument(source);
            dynamicQueryContext.setContextItem(doc);
        }
View Full Code Here

    }

    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws NoTypeConversionAvailableException {
        T answer = convertTo(type, exchange, value);
        if (answer == null) {
            throw new NoTypeConversionAvailableException(value, type);
        }
        return answer;
    }
View Full Code Here

        } else if (answer == null) {
            // there was a type, and we could not convert to it, then fail
            if (cause != null) {
                throw cause;
            } else {
                throw new NoTypeConversionAvailableException(body, type);
            }
        }

        return answer;
    }
View Full Code Here

    @Override
    public <T> T mandatoryConvertTo(Class<T> type, Object value) throws TypeConversionException, NoTypeConversionAvailableException {
        T t = convertTo(type, null, value);
        if (t == null) {
            throw new NoTypeConversionAvailableException(value, type);
        } else {
            return t;
        }
    }
View Full Code Here

    @Override
    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException, NoTypeConversionAvailableException {
        T t = convertTo(type, exchange, value);
        if (t == null) {
            throw new NoTypeConversionAvailableException(value, type);
        } else {
            return t;
        }
    }
View Full Code Here

        if (answer == Void.TYPE || value == null) {
            if (statistics.isStatisticsEnabled()) {
                missCounter.incrementAndGet();
            }
            // Could not find suitable conversion
            throw new NoTypeConversionAvailableException(value, type);
        } else {
            if (statistics.isStatisticsEnabled()) {
                hitCounter.incrementAndGet();
            }
            return (T) answer;
View Full Code Here

    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws NoTypeConversionAvailableException {
        T answer;
        try {
            answer = doConvertTo(type, exchange, value);
        } catch (Exception e) {
            throw new NoTypeConversionAvailableException(value, type, e);
        }

        if (answer == null) {
            throw new NoTypeConversionAvailableException(value, type);
        }

        return answer;
    }
View Full Code Here

    public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws NoTypeConversionAvailableException {
        Object answer;
        try {
            answer = doConvertTo(type, exchange, value);
        } catch (Exception e) {
            throw new NoTypeConversionAvailableException(value, type, e);
        }
        if (answer == Void.TYPE || value == null) {
            // Could not find suitable conversion
            throw new NoTypeConversionAvailableException(value, type);
        } else {
            return (T) answer;
        }
    }
View Full Code Here

        // we send in a bar string as header which cannot be converted to a number so it should fail
        try {
            template.requestBodyAndHeader("direct:start", "Hello World", "foo", 555);
            fail("Should have thrown an exception");
        } catch (CamelExecutionException e) {
            NoTypeConversionAvailableException ntae = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
            assertEquals(Integer.class, ntae.getFromType());
            assertEquals(Document.class, ntae.getToType());
            assertEquals(555, ntae.getValue());
            assertNotNull(ntae.getMessage());
        }

        assertMockEndpointsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.NoTypeConversionAvailableException

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.