Retrieve Annotations"
From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- | | | |} {{ZKDeveloper…') |
|||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
+ | |||
+ | 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: | ||
+ | |||
+ | <source lang="java" > | ||
+ | void dump(StringBuffer sb, Component comp) { | ||
+ | ComponentCtrl compCtrl = (ComponentCtrl)comp; | ||
+ | sb.append(comp.getId()).append(": ") | ||
+ | .append(compCtrl .getAnnotations()).append('\n'); | ||
+ | |||
+ | for (Iterator it = compCtrl.getAnnotatedProperties().iterator(); it.hasNext();) { | ||
+ | String prop = it.next(); | ||
+ | sb.append(" with ").append(prop).append(": ") | ||
+ | .append(compCtrl .getAnnotations(prop)).append('\n'); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
=Version History= | =Version History= |
Revision as of 08:51, 17 November 2010
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()).append('\n');
for (Iterator it = compCtrl.getAnnotatedProperties().iterator(); it.hasNext();) {
String prop = it.next();
sb.append(" with ").append(prop).append(": ")
.append(compCtrl .getAnnotations(prop)).append('\n');
}
}
Version History
Version | Date | Content |
---|---|---|