Actually, I spent a good bit of time trying to get @OutputProperty to
work.  My results were mixed.  First, since the code that's there now
works fine without the addition of a getter and a property, adding it
seems like a mistake.  All that adding the property and the getter
achieved was to produce a compile-time definition.  Also, when I removed
the part of the working code that explicitly sets the output value in
the setExitQuery call (might as well let the getter do its thing), the
code failed.  I think there's something a bit different about the timing
of things in the gotBeanInstance context so that the automatic usage of
the getter to access the output fails.  But even if I had succeeded with
the @OutputProperty, it's still a step backward in terms of unneeded
complexity, reliance on invisible actions, loss of re-entrance (the
field), etc.

Or I don't understand how to use it properly! :)  Thanks for your patience.

-r

Geert Bevin wrote:
> Hi Richard,
>
> the reason why there's no @OutputField annotation is because there is
> an @OutputProperty annotation that is much more useful. More
> information can be found here:
> http://rifers.org/wiki/display/RIFE/Annotations+support+for+element+declaration
>
>
> We can add an @OutputField annotation, but I'm not sure that it will
> be used much.
>
> Take care,
>
> Geert
>
> On 30 Apr 2007, at 06:46, Richard Reich wrote:
>
>> I'm very new to RIFE.  So I may be missing something very obvious.
>>
>> I'm playing with the "friends" example.  Adding stuff, changing stuff.
>> Right now, I'm trying to expunge as much XML as possible while
>> maintaining a clean component structure.  I also want to remove as many
>> string literals as possible from annotations.  (I rely on smart IDE
>> searches and typing completions.)  So I'd very much like to be able to
>> treat an element's output in the same way that the ExitField treats an
>> exit.  That is, I'd like an annotation OutputField applicable to public
>> static final Strings.
>>
>> Is this a reasonable request, consistent with the RIFE design outlook?
>>
>> FYI, the relevant fragment of the code I've been playing with is below,
>> if that helps.
>>
>> -r
>>
>> Display.java:
>>
>> @Elem(outputs = @Output(name="friendid")) // nice to get rid of the
>> "outputs"
>> public class Display extends Element {
>>     @ExitField
>>     public static final String EXIT_EDIT = "edit";
>>
>>     public void processElement() {
>>         final Template t = getHtmlTemplate("display");
>>         final Datasource ds =
>> Datasources.getRepInstance().getDatasource(Config.getRepInstance().getString("DATASOURCE"));
>>
>>         GenericQueryManager<Friend> fm =
>> GenericQueryManagerFactory.getInstance(ds, Friend.class);
>>         fm.restore(new DbBeanFetcher<Friend>(ds, Friend.class) {
>>             public boolean gotBeanInstance(Friend friend) {
>>                 setExitQuery(t, EXIT_EDIT, new String[] {"friendid",
>> Integer.toString(friend.getId())});
>>                 t.setBean(friend);
>>                 t.appendBlock("rows", "row");
>>                 return true;
>>             }
>>         });
>>
>>         print(t);
>>     }
>> }
> -- 
> Geert Bevin
> Terracotta - http://www.terracotta.org
> Uwyn "Use what you need" - http://uwyn.com
> RIFE Java application framework - http://rifers.org
> Music and words - http://gbevin.com
>
>
> _______________________________________________
> Rife-users mailing list
> [email protected]
> http://lists.uwyn.com/mailman/listinfo/rife-users
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to