@SuppressWarnings("unchecked") public TypeConverterInterceptor(Marshaller marshaller) { ServiceLoader<TypeConverter> converters = ServiceLoader.load(TypeConverter.class); for (TypeConverter converter : converters) { if (converter.supportsInvocation(Flag.OPERATION_HOTROD)) { hotRodConverter = setConverterMarshaller(converter, marshaller); } else if (converter.supportsInvocation(Flag.OPERATION_MEMCACHED)) { memcachedConverter = setConverterMarshaller(converter, marshaller); } } embeddedConverter = setConverterMarshaller(new EmbeddedTypeConverter(), marshaller); }
private TypeConverter setConverterMarshaller(TypeConverter converter, Marshaller marshaller) { if (marshaller != null) converter.setMarshaller(marshaller); return converter; }