PageRenderTime 24ms CodeModel.GetById 21ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/Converter.java

http://github.com/dhanji/sitebricks
Java | 18 lines | 5 code | 1 blank | 12 comment | 0 complexity | 99dd06ebce07e3bcd7c2728c407e4f35 MD5 | raw file
 1package com.google.sitebricks.conversion;
 2
 3/**
 4 * Convert an instance from type Source to type Target and back again.
 5 * 
 6 * Returning null indicates that the conversion was not successful and another
 7 * converter may be given the chance to handle it. Therefore, null is not a
 8 * valid converted value and null will never be passed as a parameter.
 9 * 
10 * @author John Patterson (jdpatterson@gmail.com)
11 *
12 * @param <S> Source Type 
13 * @param <T> Target Type
14 */
15public interface Converter<S, T> {
16    T to(S source);
17    S from(T target);
18}