42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility
Apache License 2.0
100 stars 22 forks source link

Suggested slight simplification to AbstractConverter #47

Closed jnash67 closed 10 years ago

jnash67 commented 10 years ago

In 0.4.0

String toString(K value) throws Exception;

was made a required part of the Converter interface. No issues with that except it should probably have a default implementation in AbstractConverter since it will usually be value.toString() anyway.

So for now, I'm using EasierAbstractConverter as follows instead of AbstractConverter:

import org.csveed.bean.conversion.AbstractConverter;

public abstract class EasierAbstractConverter<K> extends AbstractConverter<K> {

    public EasierAbstractConverter(Class<K> clazz) {
        super(clazz);
    }

    @Override
    public String toString(K value) throws Exception {
        return value.toString();
    }
}
robert-bor commented 10 years ago

Good idea, done.