package org.simpleflatmapper.reflect.getter;

import org.simpleflatmapper.converter.Converter;
import org.simpleflatmapper.reflect.Getter;

import static java.util.Objects.requireNonNull;

public class GetterWithConverter<T, I, P> implements Getter<T, P> {

    private final Converter<? super I, ? extends P> converter;
    private final Getter<? super T, ? extends I> getter;

    public GetterWithConverter(Converter<? super I, ? extends P > converter, Getter<? super T, ? extends I> getter) {
        this.converter = requireNonNull(converter, "converter");
        this.getter = requireNonNull(getter, "getter");
    }

    @Override
    public P get(T target) throws Exception {
        I in = getter.get(target);
        return converter.convert(in);
    }
}

@@ -137,56 +137,8 @@
 r;%0A%0A
-import static java.util.Objects.requireNonNull;%0A
 %0Apub
@@ -450,21 +450,20 @@
         
-this.
+if (
 converte
@@ -469,35 +469,47 @@
 er =
- requireNonNull(converter, 
+= null) throw new NullPointerException(
 %22con
@@ -530,21 +530,20 @@
     
-this.
+if (
 getter =
  req
@@ -542,41 +542,122 @@
 er =
- requireNonNull(getter, %22getter%22)
+= null) throw new NullPointerException(%22getter%22);%0A        this.converter = converter;%0A        this.getter = getter
 ;%0A  

remove ref to Objects