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

org.simpleflatmapper.map.property.SetterFactoryProperty 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.map.property;


import org.simpleflatmapper.reflect.SetterFactory;
import org.simpleflatmapper.util.TypeHelper;

import java.lang.reflect.Type;

public class SetterFactoryProperty {
    private final SetterFactory setterFactory;
    private final Type targetType;

    public SetterFactoryProperty(SetterFactory setterFactory) {
        this(setterFactory, getTargetType(setterFactory));

    }
    public SetterFactoryProperty(SetterFactory setterFactory, Type targetType) {
        this.setterFactory = setterFactory;
        this.targetType = targetType;
    }

    public Type getTargetType() {
        return targetType;
    }

    public SetterFactory getSetterFactory() {
        return setterFactory;
    }

    @Override
    public String toString() {
        return "SetterFactory{" + setterFactory + "}";
    }

    private static Type getTargetType(SetterFactory setterFactory) {
        Type[] types = TypeHelper.getGenericParameterForClass(setterFactory.getClass(), SetterFactory.class);
        return types != null ? types[0] : null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy