There's the following interface in hibernate.
package org.hibernate.transform;
public interface ResultTransformer extends Serializable {
public Object transformTuple(Object[] tuple, String[] aliases);
public List transformList(List collection);
}
In my project, I need to perfrom some transformation of the result, which is not tied with hibernate
or a database
. I would like to create an interface like
public interface ResultTranformer<T>{
public T transform(T t);
}
and implement it.
In order to not create yet another interface, is it possible to implement the interface hibernate provides us with? Could it misliead another developer?
You could use the java.util.function.Function interface for this purpose, it was meant to transform something:
Or simply by a lambda expression
Having an interface with the same name, as something from a library, might confuse others.