Given the following:
public class RegistryIdModel extends AbstractTableModel{
ContactExtensionProviderLocal provider;
.
.
.
@Override
public ContactRegistryIdProviderLocal getProvider() {
// TODO Auto-generated method stub
return provider;
}
}
public abstract class AbstractTableModel extends AbstractModel{
public abstract MutableEntityProvider getProvider();
}
public interface ContactRegistryIdProviderLocal extends MutableEntityProvider<EppContactRegistryId> {
....some methods....
}
Is it a good/bad solution to let the
method in RegistryIdModel to Override
the return type to a
ContactRegistryProviderLocal?
If I do this, it makes my life easier but what might the effects be later on?
Tanks for any help or helpful comments!
Marthin
You cannot override the return type. You can only provide (or specify) narrow implementation. This is called covariant return types (since Java 5). For example