| 1 | package com.hammurapi.convert; |
| 2 | |
| 3 | /** |
| 4 | * Base class for atomic converters. |
| 5 | * @author Pavel |
| 6 | * |
| 7 | */ |
| 8 | public abstract class AtomicConverterBase<S, T> implements AtomicConverter<S, T> { |
| 9 | |
| 10 | protected Class<S> sourceType; |
| 11 | protected Class<T> targetType; |
| 12 | |
| 13 | public Class<S> getSourceType() { |
| 14 | return sourceType; |
| 15 | } |
| 16 | |
| 17 | public Class<T> getTargetType() { |
| 18 | return targetType; |
| 19 | } |
| 20 | |
| 21 | public AtomicConverterBase(Class<S> sourceType, Class<T> targetType) { |
| 22 | super(); |
| 23 | this.sourceType = sourceType; |
| 24 | this.targetType = targetType; |
| 25 | } |
| 26 | |
| 27 | public String toString() { |
| 28 | return "AtomicConverter of "+sourceType+" (loaded by "+sourceType.getClassLoader()+") to "+targetType+" (loaded by "+targetType.getClassLoader()+")"; |
| 29 | } |
| 30 | } |