Splitting a class

Discussion in 'Java' started by Roedy Green, Jul 15, 2005.

  1. Roedy Green

    Roedy Green Guest

    Is there some refactoring tool to use when you want to split a class
    in two, so that you have a core set of methods and an extended set or
    perhaps even two independent classes.

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Jul 15, 2005
    #1
    1. Advertising

  2. Roedy Green

    Roland Guest

    On 15-7-2005 6:20, Roedy Green wrote:
    > Is there some refactoring tool to use when you want to split a class
    > in two, so that you have a core set of methods and an extended set or
    > perhaps even two independent classes.
    >

    In Eclipse, you can use 'Refactor -> Pull Up' and 'Refactor -> Push
    Down' to move members (fields and methods) up and down the class hierarchy.
    --
    Regards,

    Roland de Ruiter
    ` ___ ___
    `/__/ w_/ /__/
    / \ /_/ / \
     
    Roland, Jul 15, 2005
    #2
    1. Advertising

  3. Roedy Green

    Tim Tyler Guest

    Roedy Green <> wrote or quoted:

    > Is there some refactoring tool to use when you want to split a class
    > in two, so that you have a core set of methods and an extended set or
    > perhaps even two independent classes.


    You can drag groups of selected methods between classes in the
    Eclipse Package explorer.
    --
    __________
    |im |yler http://timtyler.org/ Remove lock to reply.
     
    Tim Tyler, Jul 15, 2005
    #3
  4. Roedy Green

    Wibble Guest

    Roedy Green wrote:
    > Is there some refactoring tool to use when you want to split a class
    > in two, so that you have a core set of methods and an extended set or
    > perhaps even two independent classes.
    >

    Lol, now you're asking questions where eclipse is the answer...
     
    Wibble, Jul 16, 2005
    #4
  5. Roedy Green

    Roedy Green Guest

    On Fri, 15 Jul 2005 20:19:26 -0400, Wibble <>
    wrote or quoted :

    >Lol, now you're asking questions where eclipse is the answer...


    Pull up never seems to be applicable since I am usually splitting off
    a sibling class. there is no hierarchy to push/pull to.

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Jul 16, 2005
    #5
  6. Roedy Green

    Dale King Guest

    Roedy Green wrote:
    > On Fri, 15 Jul 2005 20:19:26 -0400, Wibble <>
    > wrote or quoted :
    >
    >
    >>Lol, now you're asking questions where eclipse is the answer...

    >
    >
    > Pull up never seems to be applicable since I am usually splitting off
    > a sibling class. there is no hierarchy to push/pull to.


    I agree and have often wished for a "Create superclass" refactoring to
    create an empty super class that you can then "pull-up" to. It should
    also support creating superclasses for a set of classes so that all are
    then subclasses of the same superclass.

    --
    Dale King
     
    Dale King, Jul 16, 2005
    #6
    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.

Share This Page