All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.nelaupe.spreadsheetlib.FieldBinder Maven / Gradle / Ivy

package fr.nelaupe.spreadsheetlib;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Created by lucas34990 on 16/2/16.
 */
public abstract class FieldBinder {

    private List fields;

    public FieldBinder() {
        this.fields = init();
    }

    protected abstract List fill();

    public abstract Object getValueAt(String fieldName, TSelf data);

    public List fields() {
        return fields;
    }

    private List init() {
        List fields = fill();
        Collections.sort(fields, new Comparator() {
            @Override
            public int compare(AnnotationFields lhs, AnnotationFields rhs) {
                Integer positionL = lhs.getPosition();
                Integer positionR = rhs.getPosition();

                return positionL.compareTo(positionR);
            }
        });
        return Collections.unmodifiableList(fields);
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy