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

org.simpleflatmapper.GetterWithDefaultValue Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

The newest version!
package org.simpleflatmapper;

import org.simpleflatmapper.reflect.Getter;

public class GetterWithDefaultValue implements Getter {
    private final Getter delegate;
    private final P defaultValue;

    public GetterWithDefaultValue(Getter delegate, P defaultValue) {
        this.delegate = delegate;
        this.defaultValue = defaultValue;
    }

    @Override
    public P get(T target) throws Exception {
        P p = delegate.get(target);
        
        if (p == null) return defaultValue;
        
        return p;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy