Vojtech Szocs has posted comments on this change.

Change subject: userportal, webadmin: refactor: add model attribute for help 
tags
......................................................................


Patch Set 7:

Thinking about it, I think there are two different aspects:
* first, model's helpTag value used at runtime, i.e. helpTag -> 
documentationPath mapping
* second, model's helpTag + helpComment value used when running doctag.py tool

Currently, both aspects are mixed together in a single method call:

 model.setHelpTag("new_bookmark", "Main > Bookmark > New Bookmark");

But what about separating these aspects from each other? It would make parsing 
a bit easier. For example:

 @Retention(RetentionPolicy.SOURCE)  // Source-level annotation, will be 
discarded by Java compiler
 @Target(ElementType.LOCAL_VARIABLE) // Applicable only to local variables, 
declared within a method
 public @interface DocTag {
     String tagName();
     String tagComment() default "";
 }

Annotation values must always be statically resolved, i.e. by using @DocTag 
we're guaranteed to meet condition "please pass only hardcoded Strings". Inside 
model's Java code:

 private static final String BookmarkModel_HelpTag = "new_bookmark";

 ...
 @DocTag(BookmarkModel_HelpTag, "Main > Bookmark > New Bookmark")
 BookmarkModel model = new BookmarkModel();
 ...
 model.setHelpTag(BookmarkModel_HelpTag);
 ...

Parsing @DocTag will be much more easier from doctag.py tool perspective. In 
general, if we want to parse metadata from Java sources, we should always 
prefer annotations (because annotations were designed to represent static class 
metadata), i.e. avoid parsing specific Java (in this case method call) 
statemets.

-- 
To view, visit http://gerrit.ovirt.org/21052
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia4074fcc2ecfcbdd2ea6c0855d92f2aa4bd26a5b
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to