Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to override an abstract method returning an interface type

Reply
Thread Tools

How to override an abstract method returning an interface type

 
 
etantonio@gmail.com
Guest
Posts: n/a
 
      07-06-2006
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...

many thanks if you can help me

Antonio D'Ottavio
www.etantonio.it/en

 
Reply With Quote
 
 
 
 
Matt Humphrey
Guest
Posts: n/a
 
      07-06-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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...


If all you're trying to do is to reach a compilable state, simply have the
method throw an exception that says "Not implemented".

throw new UnsupportedOperationException ("Not implemented.");

You don't have to declare this kind of exception.

Cheers,
Matt Humphrey http://www.velocityreviews.com/forums/(E-Mail Removed) http://www.iviz.com/


 
Reply With Quote
 
 
 
 
vahan
Guest
Posts: n/a
 
      07-07-2006
I'm agree with Matt, you have to write in your subclass:

ParameterMetaData getParameterMetaData() throws SQLException {
throw new UnsupportedOperationException ("Not implemented.");
}

Matt Humphrey wrote:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> > 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...

>
> If all you're trying to do is to reach a compilable state, simply have the
> method throw an exception that says "Not implemented".
>
> throw new UnsupportedOperationException ("Not implemented.");
>
> You don't have to declare this kind of exception.
>
> Cheers,
> Matt Humphrey (E-Mail Removed) http://www.iviz.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Using "abstract" on a class with no abstract method Stefan Ram Java 27 08-17-2009 12:36 AM
Abstract method in non-abstract class Chris Zopers ASP .Net 2 08-08-2008 11:40 AM
Interface and Abstract Class Can have same method or not prabhat tiwari ASP .Net 1 05-01-2007 10:21 AM
About abstract class and abstract method Sameer Java 4 08-31-2005 12:59 AM



Advertisments