Retrieve Annotations"

From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- |   |   |   |} {{ZKDeveloper…')
 
m (remove empty version history (via JWB))
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
  
=Version History=
+
The annotations can be retrieved back at the run-time. They are designed to be used by tools or utilities, such as the data-binding manager, rather than applications. In other words, applications annotate a ZUML page to tell the tools how to handle components for a particular purpose.
{{LastUpdated}}
+
 
{| border='1px' | width="100%"
+
The following is an example to dump all annotations of a component:
! Version !! Date !! Content
+
 
|-
+
<source lang="java" >
| &nbsp;
+
void dump(StringBuffer sb, Component comp) {
| &nbsp;
+
    ComponentCtrl compCtrl = (ComponentCtrl)comp;
| &nbsp;
+
    sb.append(comp.getId()).append(": ")
|}
+
      .append(compCtrl .getAnnotations(null)).append('\n');
 +
 
 +
    for (String prop: compCtrl.getAnnotatedProperties()) {
 +
        sb.append(" with ").append(prop).append(": ")
 +
            .append(compCtrl .getAnnotations(prop)).append('\n');
 +
    }
 +
}
 +
</source>
 +
 
 +
 
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Latest revision as of 04:33, 5 February 2024


Retrieve Annotations


The annotations can be retrieved back at the run-time. They are designed to be used by tools or utilities, such as the data-binding manager, rather than applications. In other words, applications annotate a ZUML page to tell the tools how to handle components for a particular purpose.

The following is an example to dump all annotations of a component:

 void dump(StringBuffer sb, Component comp) {
    ComponentCtrl compCtrl = (ComponentCtrl)comp;
     sb.append(comp.getId()).append(": ")
       .append(compCtrl .getAnnotations(null)).append('\n');

     for (String prop: compCtrl.getAnnotatedProperties()) {
         sb.append(" with ").append(prop).append(": ")
             .append(compCtrl .getAnnotations(prop)).append('\n');
     }
 }




Last Update : 2024/02/05

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.