Re: How to override an abstract method returning an interface type
"Ingo R. Homann" <ihomann_spam@web.de> wrote in message
news:44ad0a9a$0$26270$9b4e6d93@newsread2.arcor-online.net...
Hi,
etantonio@gmail.com wrote:
Ciao,
I've this class that implements the interface PreparedStatement
public class SCTRDebuggableStatement implements PreparedStatement
{ .... }
but I've not implemented the abstract method ParameterMetaData so
defined in PreparedStatement
ParameterMetaData getParameterMetaData() throws SQLException;
Also ParameterMetaData is an interface, all that I need is to compile a
very big project, I'm not interested to these classes but how can I
modify SCTRDebuggableStatement to finally see it compile without
errors...
To make it compile (without ever using this method), implement it by
returning null or better throwing an Exception:
ParameterMetaData getParameterMetaData() throws SQLException {
throw new RuntimeException("Not yet implemented!");
}
I usually use NotImplementedException() for this purpose. It's in the
sun.reflect.generics package, and it's not documented AFAIK, so I'm not sure
if that's the intended purpose...
I've even customized my Eclipse so that instead of generiting methods
like
public Object foo() {
//TODO: Autogenerated method
return null;
}
it generates code like:
public Object foo() {
//TODO: Autogenerated method
throw new NotImplementedException();
}
- Oliver