title: Java 8 Functional Programming - Need to write a generic function on class
body: <p>I want to create a method that accepts something like this</p>
  
  <pre><code>set(nodeStatus, status, NodeStatus::setStatus, Status::valueOf);
  set(nodeStatus, errorCode, NodeStatus::setErrorCode, ErrorCode::valueOf);
  </code></pre>
  
  <p>Status and ErrorCode are enums in java.</p>
  
  <p>Signature and pseudocode</p>
  
  <pre><code>set(NodeStatus nodeStatus, byte[] status, ?nodeStatusOperator , ?ValueTransformer) {
     1. convert byte[] status to appropriate value as per ValueTransformer
     2. nodeStatusOperator sets this transformed value according to the lambda passed.
  }
  </code></pre>
  
  <p>I want to know what method signature should be used to accompalish this in java and why. I tried various Consumers, BiConsumers etc but couldnt do this. Can anyone please help?</p>