001package com.hammurapi.convert; 002 003import java.util.concurrent.Future; 004 005import com.hammurapi.common.Context; 006 007public class FutureConverterPart implements ConverterPart { 008 009 @Override 010 public <S, T> T convert(S source, Class<T> targetType, Context context, Converter master) throws ConversionException { 011 if (source instanceof Future) { 012 try { 013 Object value = ((Future) source).get(); 014 return master.convert(value, targetType, context); 015 } catch (Exception e) { 016 throw new ConversionException(e); 017 } 018 019 } 020 return null; 021 } 022 023}