Last active
August 29, 2015 13:57
-
-
Save uklance/9617036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConverterGridDataSource implements GridDataSource { | |
private final GridDataSource delegate; | |
private final Converter converter; | |
public ConverterGridDataSource(GridDataSource delegate, Converter converter) { | |
this.delegate = delegate; | |
this.converter = converter; | |
} | |
public int getAvailableRows() { | |
return delegate.getAvailableRows(); | |
} | |
public void prepare(int startIndex, int endIndex, List<SortConstraint> sortConstraints) { | |
delegate.prepare(startIndex, endIndex, sortConstraints); | |
} | |
public Object getRowValue(int index) { | |
return converter.convert(delegate.getRowValue(index)); | |
} | |
public Class getRowType() { | |
return converter.getType(); | |
} | |
} | |
public interface Converter<T> { | |
T convert(Object o); | |
Class<T> getType(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment