All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.converter.IOConverterLoader Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
/* Generated by org.apache.camel:apt */
package org.apache.camel.converter;

import org.apache.camel.Exchange;
import org.apache.camel.TypeConversionException;
import org.apache.camel.TypeConverterLoaderException;
import org.apache.camel.spi.TypeConverterLoader;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.support.SimpleTypeConverter;
import org.apache.camel.support.TypeConverterSupport;
import org.apache.camel.util.DoubleMap;

/**
 * Source code generated by org.apache.camel:apt
 */
@SuppressWarnings("unchecked")
public final class IOConverterLoader implements TypeConverterLoader {

    public IOConverterLoader() {
    }

    @Override
    public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
        registerConverters(registry);
    }

    private void registerConverters(TypeConverterRegistry registry) {
        addTypeConverter(registry, byte[].class, java.io.BufferedReader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toByteArray((java.io.BufferedReader) value, exchange));
        addTypeConverter(registry, byte[].class, java.io.ByteArrayOutputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toByteArray((java.io.ByteArrayOutputStream) value));
        addTypeConverter(registry, byte[].class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toByteArray((java.io.File) value));
        addTypeConverter(registry, byte[].class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toBytes((java.io.InputStream) value));
        addTypeConverter(registry, byte[].class, java.io.Reader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toByteArray((java.io.Reader) value, exchange));
        addTypeConverter(registry, byte[].class, java.lang.String.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toByteArray((java.lang.String) value, exchange));
        addTypeConverter(registry, java.io.BufferedReader.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toReader((java.io.File) value, exchange));
        addTypeConverter(registry, java.io.BufferedWriter.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toWriter((java.io.File) value, exchange));
        addTypeConverter(registry, java.io.File.class, java.lang.String.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toFile((java.lang.String) value));
        addTypeConverter(registry, java.io.InputStream.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((byte[]) value));
        addTypeConverter(registry, java.io.InputStream.class, java.io.BufferedReader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.io.BufferedReader) value, exchange));
        addTypeConverter(registry, java.io.InputStream.class, java.io.ByteArrayOutputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.io.ByteArrayOutputStream) value));
        addTypeConverter(registry, java.io.InputStream.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.io.File) value));
        addTypeConverter(registry, java.io.InputStream.class, java.lang.String.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.lang.String) value, exchange));
        addTypeConverter(registry, java.io.InputStream.class, java.lang.StringBuffer.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.lang.StringBuffer) value, exchange));
        addTypeConverter(registry, java.io.InputStream.class, java.lang.StringBuilder.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.lang.StringBuilder) value, exchange));
        addTypeConverter(registry, java.io.InputStream.class, java.net.URL.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.net.URL) value));
        addTypeConverter(registry, java.io.InputStream.class, java.util.stream.Stream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toInputStream((java.util.stream.Stream) value, exchange));
        addTypeConverter(registry, java.io.ObjectInput.class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toObjectInput((java.io.InputStream) value, exchange));
        addTypeConverter(registry, java.io.ObjectOutput.class, java.io.OutputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toObjectOutput((java.io.OutputStream) value));
        addTypeConverter(registry, java.io.OutputStream.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toOutputStream((java.io.File) value));
        addTypeConverter(registry, java.io.Reader.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toReader((byte[]) value, exchange));
        addTypeConverter(registry, java.io.Reader.class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toReader((java.io.InputStream) value, exchange));
        addTypeConverter(registry, java.io.StringReader.class, java.lang.String.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toReader((java.lang.String) value));
        addTypeConverter(registry, java.io.Writer.class, java.io.OutputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toWriter((java.io.OutputStream) value, exchange));
        addTypeConverter(registry, java.lang.String.class, byte[].class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((byte[]) value, exchange));
        addTypeConverter(registry, java.lang.String.class, java.io.BufferedReader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.io.BufferedReader) value));
        addTypeConverter(registry, java.lang.String.class, java.io.ByteArrayOutputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.io.ByteArrayOutputStream) value, exchange));
        addTypeConverter(registry, java.lang.String.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.io.File) value, exchange));
        addTypeConverter(registry, java.lang.String.class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.io.InputStream) value, exchange));
        addTypeConverter(registry, java.lang.String.class, java.io.Reader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.io.Reader) value));
        addTypeConverter(registry, java.lang.String.class, java.net.URL.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toString((java.net.URL) value, exchange));
        addTypeConverter(registry, java.nio.ByteBuffer.class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.covertToByteBuffer((java.io.InputStream) value));
        addTypeConverter(registry, java.util.Properties.class, java.io.File.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toProperties((java.io.File) value));
        addTypeConverter(registry, java.util.Properties.class, java.io.InputStream.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toProperties((java.io.InputStream) value));
        addTypeConverter(registry, java.util.Properties.class, java.io.Reader.class, false,
            (type, exchange, value) -> org.apache.camel.converter.IOConverter.toProperties((java.io.Reader) value));
    }

    private static void addTypeConverter(TypeConverterRegistry registry, Class toType, Class fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) { 
        registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy