title: Is there any workaround for a generic argument in a functional interface?
body: <p>I'm trying to shorten my database access code by creating only one method of each type (update, fetch) in the base - Component class.
  To do that, I need to store getters and setters somehow to append them to queries when needed - and to not to use reflection.
  So I came with this:</p>
  
  <pre><code>class Component{
      protected final HashMap&lt;String, Pair&lt;Getter,Setter&gt;&gt; FIELDS = new HashMap&lt;&gt;();
      public void updateInDB(){
          // create update query, iterating through FIELDS (getters)
      }
  }
  
  
  public class TestComponent extends Component {
  
      private String color1;
  
      protected TestComponent(String user_id) {
          super(user_id);
          FIELDS.put("color1", new Pair&lt;&gt;(this::getColor1, this::setColor1));
      }
  
      public String getColor1() {
          return color1;
      }
  
      public void setColor1(String color1) {
          this.color1 = color1;
      }
  }
  </code></pre>
  
  <p>Getter looks like this:</p>
  
  <pre><code>public interface Getter&lt;T&gt; {
      T get();
  }
  </code></pre>
  
  <p>Setter:</p>
  
  <pre><code>public interface Setter&lt;T&gt; {
      void set(T value);
  }
  </code></pre>
  
  <p>And the Pair class:</p>
  
  <pre><code>public class Pair&lt;A, B&gt; {
  
      private A first = null;
      private B second = null;
  
      public Pair(A first, B second) {
          this.first = first;
          this.second = second;
      }
  
      public A getFirst() {
          return first;
      }
  
      public void setFirst(A first) {
          this.first = first;
      }
  
      public B getSecond() {
          return second;
      }
  
      public void setSecond(B second) {
          this.second = second;
      }
  
  }
  </code></pre>
  
  <p>The error is: <strong>B is not a functional interface</strong>, which means that Setter interface is not a functional interface. Is there any possible workaround for this?</p>