I have one List box
and I would like to set code type of it.
I create new AbstractCodeType
:
public class MyCodeType extends AbstractCodeType<String, String> {
private static final long serialVersionUID = 6808664924551155395L;
public static final String ID = null;
@Override
public String getId() {
return ID;
}
@Order(10.0)
public static class UnknownCode extends AbstractCode<String> {
private static final long serialVersionUID = -1307260056726644943L;
public static final String ID = "Unknown";
@Override
protected String getConfiguredText() {
return TEXTS.get("Unknown");
}
@Override
public String getId() {
return ID;
}
}
}
and I set this code type in list box :
@Override
protected Class<? extends ICodeType<?, String>> getConfiguredCodeType() {
return MyCodeType.class;
}
But doesn't work. It return empty box.
While I was debugging I noticed that in AbstractListBox.class
in initConfig
method it call this code type and set code type in m_lookupCall
inside setCodeTypeClass
. Then inside execLoadTableData
, it get call
but this call return empty array when called call.getDataByAll()
.
I suspect that converting between code type and Lookup call does not work properly.
EDIT
I try to debug where is the problem and if follow the path :
initConfig() -> CodeLookupCall.newInstanceByService(m_codeTypeClass); (line 581)
and if you look inside CodeLookupCall
;
getDataByAll() in line 221 `resolveCodes(v)` -> BEANS.opt(m_codeTypeClass) -> bean.getInstance() -> m_producer.produce(this) -> return (T) getCache().get(createCacheKey(type));
This is in class CodeService.class in line 97 :
Class<T>
type is right class and createCacheKey(type)
return not null object but then getCache().get(...)
return null
. From this point on everything is null (what is reasonable regarding that getCodeType return null.)
This is what I found out while debugging, if it helps someone to figure out what is wrong.