Search in sources :

Example 1 with TypeConverterOutput

use of org.apache.camel.cdi.pojo.TypeConverterOutput in project camel by apache.

the class InjectedTypeConverterTest method convertWithTypeConverter.

@Test
public void convertWithTypeConverter(TypeConverter converter) throws NoTypeConversionAvailableException {
    TypeConverterInput input = new TypeConverterInput();
    input.setProperty("property value is [{{property2}}]");
    TypeConverterOutput output = converter.mandatoryConvertTo(TypeConverterOutput.class, input);
    assertThat(output.getProperty(), is(equalTo("property value is [value 2]")));
}
Also used : TypeConverterInput(org.apache.camel.cdi.pojo.TypeConverterInput) TypeConverterOutput(org.apache.camel.cdi.pojo.TypeConverterOutput) Test(org.junit.Test)

Example 2 with TypeConverterOutput

use of org.apache.camel.cdi.pojo.TypeConverterOutput in project camel by apache.

the class InjectedTypeConverter method convert.

@Converter
public TypeConverterOutput convert(TypeConverterInput input) throws Exception {
    TypeConverterOutput output = new TypeConverterOutput();
    output.setProperty(context.resolvePropertyPlaceholders(input.getProperty()));
    return output;
}
Also used : TypeConverterOutput(org.apache.camel.cdi.pojo.TypeConverterOutput) Converter(org.apache.camel.Converter)

Aggregations

TypeConverterOutput (org.apache.camel.cdi.pojo.TypeConverterOutput)2 Converter (org.apache.camel.Converter)1 TypeConverterInput (org.apache.camel.cdi.pojo.TypeConverterInput)1 Test (org.junit.Test)1