Package org.apache.camel

Examples of org.apache.camel.NoTypeConversionAvailableException


                    }
                }

                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

    }

    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

    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

        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

        ObjectHelper.notNull(camelContext, "CamelContext of Exchange");
        TypeConverter converter = camelContext.getTypeConverter();
        if (converter != null) {
            return converter.mandatoryConvertTo(type, exchange, value);
        }
        throw new NoTypeConversionAvailableException(value, type);
    }
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

    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

                    }
                }

                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);
            } finally {
View Full Code Here

        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

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.