tag:blogger.com,1999:blog-741750605858169835.post8319862773242578402..comments2024-01-24T14:53:02.919+00:00Comments on Stephen Colebourne's blog: Java 7 - Update on PropertiesStephen Colebournehttp://www.blogger.com/profile/01454237967846880639noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-741750605858169835.post-30333166775484076272007-10-09T23:42:23.000+01:002007-10-09T23:42:23.000+01:00Why not
Person mother = ...;
PropertyDelegate sur...Why not<br />Person mother = ...;<br /> PropertyDelegate surnamePropertyDelegate = BeanProperty.create("surname");<br /> String surname = surnamePropertyDelegate.getValue(mother);<br /><br />versus<br /><br /> Person mother = ...;<br /> Property surnameProperty = BeanProperty.create("surname", mother);<br /> String surname = surnameProperty.getValue();<br /><br />and thus<br /><br />surnamePropertyDelegate.getProperty(mother).getValue()sakinoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-69458523305446008742007-09-28T17:29:06.000+01:002007-09-28T17:29:06.000+01:00@Mikael, I believe that people use the name 'P...@Mikael, I believe that people use the name 'Property' to be per-class is that it matches with 'Field' and 'Method'. The whole set are at the meta-level. Thus we need to find a different name for the instantiated property holding the actual value, perhaps PropertyAccessor or PropertyInstance.<br /><br />As for the table column, IMO it should ideally be a binding between the property instance for the table column, and the (meta) property for the data.<br /><br />bind(myTableColumn#value, Person#surname);<br /><br />As can be seen, the column is lined to an instance, while the data model is just referring to the surname property on any and all Person objects.Stephen Colebournenoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-68202878527797060362007-09-28T15:22:17.000+01:002007-09-28T15:22:17.000+01:00Stephen, are you assuming the connection to a bean...Stephen, are you assuming the connection to a bean can not be changed once set? Of course it can. You can create 'per-instance' JTable property where the JTable/model is settable with a setBean() method. At least this is how I think of it.<br /><br />Btw, IMO a property that is per-class is actually a PropertyAdapter, not a Property.<br /><br />Cheers,Mikael Grevnoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-83666097879938239112007-09-28T10:38:25.000+01:002007-09-28T10:38:25.000+01:00A better Sun RFE link is http://bugs.sun.com/bugda...A better Sun RFE link is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5043025Stephen Colebournenoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-4376640034246439142007-09-28T10:21:42.000+01:002007-09-28T10:21:42.000+01:00@i30817, I prefer, as do others, adding the # oper...@i30817, I prefer, as do others, adding the # operator simply for the additional clarity. Person.surname looks like it is accessing the surname field which returns a String. What we want here is to return the *meta* information about the surname, the Property object, hence Person#surname.<br /><br />@svenmeier, Thanks for the link.<br /><br />@Mikael, Bindings can be added to the JTable before there any model beans have been created. The list of model beans may grow or shrink. You don't want to link the actual model bean to the column, you just want to link the fact that the surname should be extracted from each model bean.<br /><br />Re-reading your comment, you ask why a link to the JTable bean would have an effect. It doesn't, and thats not the reason why per-instance doesn't work. The reason is linked to the model beans (Person etc.).Stephen Colebournenoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-23585490010947043622007-09-28T08:42:43.000+01:002007-09-28T08:42:43.000+01:00Just in case you missed it, the debate over a synt...Just in case you missed it, the debate over a syntax for compile-time checked member access (not just properties) is old enough:<br /><br />http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4810162svenmeiernoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-74609180479848772432007-09-28T07:38:37.000+01:002007-09-28T07:38:37.000+01:00Hello Stephen,
I have created a property proposal...Hello Stephen,<br /><br />I have created a property proposal (not public yet) and it is using the per instance approach. I have heard Jesse say that thing about the JTable should be a problem but no one has explained why. I can't imagine why a connection to the bean (JTable) should change anything. Can you explain?Mikael Grevnoreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-45919578104273973112007-09-27T20:59:35.000+01:002007-09-27T20:59:35.000+01:00I'd like that the syntax allowed the . operato...I'd like that the syntax allowed the . operator instead. Whats the horrible thing about LangProperty.create(Person.surname), field aliasing? Just develop an hiearchy, and a warning:<br />Warning method-field alising using a property, using the method...<br />Anyway fields with the same name as methods are LAME, and should have been forbidden. Don't introduce operators for no reason at all.i30817noreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-70066271510337005282007-09-27T16:45:40.000+01:002007-09-27T16:45:40.000+01:00Thanks for the brilliant recap, Stephen. I'm s...Thanks for the brilliant recap, Stephen. I'm still trying to wedge in a few more changes to the existing Property abstract class. These people - they love abstract classes for some reason! I don't understand it.Jesse Wilsonhttp://publicobject.com/noreply@blogger.comtag:blogger.com,1999:blog-741750605858169835.post-13872052319299377102007-09-27T16:13:28.000+01:002007-09-27T16:13:28.000+01:00It would be great news if Java 7 would include pro...It would be great news if Java 7 would include properties support. The # syntax seems just fine. I really hate having strings for properties (the main reason being that no IDE is smart enough to handle them with refactoring or even a simple "find usage" case).Emilian Boldhttp://www.emilianbold.ronoreply@blogger.com