I need to start work from two different screens with two different models, but both models have common information that I need in a new action. The problem is that I cannot get these models to propagate from the same parent, because one of the models already extends one parent. I was thinking of creating an interface that contains common methods, but if I do, how can I put this interface in the package needed to run the next action?
I will add simplified code to clarify the situation:
public class A extends Model implements CustomInterface { String name; String address; public String getName(){ return name; } public String getAddress() { return address; } } public class B implements CustomInterface { String name; public String getName() { return name; } } public interface CustomInterface { String getName(); }
My problem is that I need to get started with a package with general information between both models. So, I would like to add CustomInterface to the package. How can i do this?
Thanks in advance.
source share