org.apache.camel.component.twilio.TwilioConverterLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of camel-twilio Show documentation
Show all versions of camel-twilio Show documentation
Camel Component for Twilio
package org.apache.camel.component.twilio;
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;
@SuppressWarnings("unchecked")
public class TwilioConverterLoader implements TypeConverterLoader {
public TwilioConverterLoader() {
}
@Override
public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
registerConverters(registry);
}
private void registerConverters(TypeConverterRegistry registry) {
addTypeConverter(registry, com.twilio.type.PhoneNumber.class, java.lang.String.class, false,
(type, exchange, value) -> org.apache.camel.component.twilio.TwilioConverter.toPhoneNumber((java.lang.String) value));
addTypeConverter(registry, com.twilio.type.Sip.class, java.lang.String.class, false,
(type, exchange, value) -> org.apache.camel.component.twilio.TwilioConverter.toSip((java.lang.String) value));
}
private 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