Steps to Reproduce
1. put a lang-addon.xml under maven project resources/metainfo/zk/
<?xml version="1.0" encoding="UTF-8"?> <language-addon> <addon-name>myaddon</addon-name> <language-name>xul/html</language-name> <depends>zkbind</depends> <component> <component-name>listbox</component-name> <extends>listbox</extends> <annotation> <annotation-name>ZKBIND</annotation-name> <property-name>model</property-name> <attribute> <attribute-name>CONVERTER</attribute-name> <attribute-value>org.zkoss.mvvm.MyListboxConverter</attribute-value> </attribute> </annotation> </component> </language-addon>
2. run the attached zul
Current Result
a listbox still use the default system converter
Expected Result
a listbox should run with MyListboxConverter
Debug Information
- this doesn't happen on 8.5.2.1
- in AnnotationUtil.java
public static Annotation getSystemAnnotation(ComponentCtrl compCtrl, String propName) { ... //Use custom ZKBIND annotation instead of default ZKBIND annotation if any if (annos instanceof List) { return (Annotation) ((List) annos).get(0); }
but the custom convert specified in lang-addon.xml is the last item in annos
workaround
import org.zkoss.bind.Binder; import org.zkoss.zk.ui.WebApp; import org.zkoss.zk.ui.metainfo.*; import org.zkoss.zk.ui.util.WebAppInit; import java.util.*; public class MyWebInit implements WebAppInit { @Override public void init(WebApp wapp) throws Exception { Collection<Annotation> annotations = LanguageDefinition.lookup(null).getComponentDefinition("listbox") .getAnnotationMap().getAnnotations("model", Binder.ZKBIND); if (annotations.size() > 1) { Iterator iterator = annotations.iterator(); iterator.next(); iterator.remove(); } } }
- relates to
-
ZK-3324 multiple ZKBIND annotations at a field undecided
- Closed