History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RIFE-303
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Geert Bevin
Reporter: Mike Aizatsky
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
RIFE

Property name annotations attribute

Created: 09/Aug/06 12:42 PM   Updated: 10/Mar/07 12:22 AM
Component/s: engine
Affects Version/s: 1.5
Fix Version/s: 1.6

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Scale: Bite-sized


 Description  « Hide
I really liked the idea of FlowlinkExitField annotations. However the major source of string constants is still present and hardcoded - property names.

I'd like to add an optional "name" attribute to all property annotations. That way I could introduce a constant with property name, and use it in a "name" attribute. And RIFE would check, that property name, and attribute value are indeed in sync. That way I would be also able to find usages of the property name constant, thus all links to it.

E.g.:

public static final String PROPERTY_ID = "id";

@InputProperty(name=PROPERTY_ID)
public void setId(int id) {....}

and later:

@Datalink(srcOutput = PROPERTY_ID, destInput = TargetElement.PROPERTY_ID)}


 All   Comments   Work Log   Change History      Sort Order:
Geert Bevin [14/Aug/06 03:43 AM]
Been thinking about this some more. This would require another layer of indirection in the RIFE site structure. Currently, injection and outjection happens on a name-basis, so when an input, output, ... is declared and the setter / getter is present with the same name, that one will be used to inject / outject the values.

However, to be able to support this annotation, there need to be another mapping layer that links the data entity names to the actual setter and getter names. This is needed because people can specify a different name through this annotation.

While this can be added, I'm not sure that the additional layer of complexity is warranted in reality (since it has to be added to the lowest layer, which is the one that performs the bijection). I'm saying this because I implemented RIFE-269 today and I think that you actually might end up using that instead. What do you think?

Steven Grimm [18/Aug/06 11:53 PM]
I didn't read this as a request to allow the names to differ, but more as a request for an additional startup-time sanity check. For example, doing

public final static String PROPERTY_ID = "id";
@InputProperty(name=PROPERTY_ID)
public void setSomeOtherPropertyName(int id) { }

would throw a configuration error during RIFE's inital parsing of the site structure. Right now you can declare a property name as a static string and refer to it from other classes, but there is nothing to prevent that property name from referring to some property that isn't even present on the element.

Autolinking doesn't take care of that problem entirely, because it still relies on keeping names in sync by hand. If I have an autolink and I change a property name on one side, that property will simply silently stop being linked.

Mike, do I have your intent right?

Steven Grimm [18/Aug/06 11:57 PM]
This idea, if it happens, should also be applied to submission handlers; see RIFE-304 for rationale.

Mike Aizatsky [20/Aug/06 01:28 PM]
Steven,

You are right. The main idea is to have all constants for property names automatically checked.

Geert Bevin [20/Aug/06 01:48 PM]
That makes sense then and shouldn't be very hard to implement.

Geert Bevin [10/Mar/07 12:21 AM]
Implemented for all property related annotations, not just input and output.