| EMMA Coverage Report (generated Thu Jan 20 11:39:44 EST 2011) |
|---|
| [all classes][com.hammurapi.convert] |
| name | class, % | method, % | block, % | line, % |
|---|---|---|---|---|
| SingletonConverterPart.java | 100% (1/1) | 100% (2/2) | 93% (25/27) | 88% (7/8) |
| name | class, % | method, % | block, % | line, % |
|---|---|---|---|---|
| class SingletonConverterPart | 100% (1/1) | 100% (2/2) | 93% (25/27) | 88% (7/8) |
| convert (Object, Class, Context, Converter): Object | 100% (1/1) | 92% (22/24) | 86% (6/7) | |
| SingletonConverterPart (): void | 100% (1/1) | 100% (3/3) | 100% (1/1) |
| 1 | package com.hammurapi.convert; |
| 2 | |
| 3 | import java.util.Iterator; |
| 4 | import java.util.concurrent.Callable; |
| 5 | |
| 6 | import com.hammurapi.common.Context; |
| 7 | |
| 8 | public class SingletonConverterPart implements ConverterPart { |
| 9 | |
| 10 | @Override |
| 11 | public <S, T> T convert(S source, Class<T> targetType, Context context, Converter master) throws ConversionException { |
| 12 | if (source instanceof Iterable) { |
| 13 | Iterator it = ((Iterable) source).iterator(); |
| 14 | if (it.hasNext()) { |
| 15 | Object value = it.next(); |
| 16 | if (!it.hasNext()) { |
| 17 | return master.convert(value, targetType, context); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | return null; |
| 22 | } |
| 23 | |
| 24 | } |
| [all classes][com.hammurapi.convert] |
| EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov |