Author Topic: 'Hide Property Methods' bug  (Read 4460 times)

julian

  • Guest
'Hide Property Methods' bug
« on: April 01, 2005, 12:50:23 am »
Hi all,

I'm having difficulty with the 'hide property methods' feature -- my understanding was that it would do a javabean match of 'like pairs' of property methods of the form  Class getXXX() / void setXXX( Class pObject ) but it doesn't seem to work in 4.5.1 -- I want to take a 'property and method' view on classes and the get/set java mess gets in the way... I had hoped this feature solved this problem.

thanks muchly!

Julian

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: 'Hide Property Methods' bug
« Reply #1 on: April 03, 2005, 03:01:47 pm »
It hides methods based on the stereotype.  It will hide any methods with one of the following stereotypes.
  • property
  • property get
  • property set
  • property let
Simon

julian

  • Guest
Re: 'Hide Property Methods' bug
« Reply #2 on: April 03, 2005, 03:31:58 pm »
Thanks Simon yes I was aware that is what its intention was, but it doesn't seem to work for me. Here's a simple test class which doesn't work properly:

import java.util.String;

public class Test {
private String mName;

void setName( String pName )
{ mName = pName; }

String getName()
{ return mName; }

}


If you import this into EA 4.5.1 and choose 'Hide Property Methods' it will not hide the getName() setName() methods.

I suggested this feature to Geoffrey back in 2000; he implemented it in like 2 days and worked like a treat; perhaps no one else uses it? :) I find it very useful and have a large body of classes to analyse and would like to see whether it could be reinstated.

regards,
Julian

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: 'Hide Property Methods' bug
« Reply #3 on: April 03, 2005, 04:30:33 pm »
What you need to do is set up EA so that if you were creating the property methods it would create methods with the name.

Look at the generation page in the local options dialog.  To get those methods to get the property stereotype I had to add "m" to the remove prefixes field.  You may also need to play around with the Capitalized attribute name and use is options on that page.

Simon

julian

  • Guest
Re: 'Hide Property Methods' bug
« Reply #4 on: April 03, 2005, 11:11:06 pm »
Hi Simon -- tried all that -- I had already added 'm' as a prefix -- please can you try this class in your project as I'm not yet convinced that this isn't a bug. If you have any specific suggestions that'd be great - statements like 'What you need to do is set up EA so that if you were creating the property methods it would create methods with the name' -- I'm not clear what to do with because this is all to do with importing existing classes, not creating new classes, so it's about EA's representation of that.

thanks,

Julian

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: 'Hide Property Methods' bug
« Reply #5 on: April 04, 2005, 03:07:40 pm »
Actually, I did try it.  That's why I stated what I did.

What build of EA have you tried it on.  Builds before 745 (EA 4.51) didn't set the property stereotypes on these methods at all.

From 745 on EA uses the options that you have set to determine whether a function is a property.  For example, to get the methods in the code you gave to import as properties I needed to:
  • Add m as a prefix to remove.  My prefixes to remove is now m_s;m_n;m_b;m_;m;
  • Treat as suffixes should NOT be set.  (It isn't by default)
  • Capitalized Attribute Name for Properties doesn't matter for this example as after removing the m the attribute name is capitalized anyway.  It will need to be set appropriately under most circumstances though.
  • Is 'Is' for Boolean property Get() doesn't matter as this is not a boolean property, but again, it will need to be set as appropriate for your larger body of code.
  • Set Prefix for java should be "set"
  • Get Prefix for java should be "get"
My statement about the setup before was trying to say that when EA imports methods and attempts to match them to properties it uses the same settings as when it is creating properties to know what a property for a given attribute should look like.

Simon

julian

  • Guest
Re: 'Hide Property Methods' bug
« Reply #6 on: April 05, 2005, 12:36:16 am »
Hi Simon -- ok I found the problem, somewhat unintuitively, that last semicolon on the member list was essential; what I had was:

m_s;m_n;m_b;m_;m

I think the other problem is that I was using an earlier build of 4.5.1 for the import; the current version seems to work but I did the import on a previous version; I've done extensive work on the class diagrams so I might just leave it for now.

thanks for your help Simon.

regards,
Julian