How to override an abstract method returning an interface type

Discussion in 'Java' started by etantonio@gmail.com, Jul 6, 2006.

  1. Guest

    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
    , Jul 6, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > 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.iviz.com/
    Matt Humphrey, Jul 6, 2006
    #2
    1. Advertising

  3. vahan Guest

    I'm agree with Matt, you have to write in your subclass:

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

    Matt Humphrey wrote:
    > <> wrote in message
    > news:...
    > > 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.iviz.com/
    vahan, Jul 7, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sameer
    Replies:
    4
    Views:
    601
    Roedy Green
    Aug 31, 2005
  2. prabhat tiwari
    Replies:
    1
    Views:
    601
    Alex Meleta
    May 1, 2007
  3. Chris Zopers

    Abstract method in non-abstract class

    Chris Zopers, Aug 8, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    373
    Göran Andersson
    Aug 8, 2008
  4. Stefan Ram
    Replies:
    27
    Views:
    735
    Stefan Ram
    Aug 17, 2009
  5. mix
    Replies:
    0
    Views:
    348
Loading...

Share This Page