Is it possible to bind a HashMap
to the client-sided binder? In Flow I can use own logic when binding a component to a field, but is also possible in Hilla binder?
Best
The point of Hilla is that you should define DTO object in your @BrowserCallable
. This will eliminate need for HashMap.
I am still the specification phase of my data structure and I am not sure where should define properties that are depending on the type
of the content of the bean.
I think I need to go for all in one:
public class WStep {
public enum WStepType {
PROMPT, CONDITION, TOOL
}
private WStepType type;
// all attributes for all types
private String text;
private String toolName;
private Object toolConfig;
[...]
}
instead of creating a hierarchy, becausen then I would need to switch the binder for the same bean.
public class WStep {
public enum WStepType {
PROMPT, CONDITION, TOOL
}
private WStepType type;
}
public class WPromptStep extends WStep {
private String text;
}
public class WToolStep extends WStep {
private String toolName;
private Object toolConfig;
}
I thought I could save the attributes in a map instead of creating multiple classes and binders.
While typing I thought of extracting the config of the class, so I still need to switch binders, but only on the attributes that differs between each types…
public class WStep { // binder 1
public enum WStepType {
PROMPT, CONDITION, TOOL
}
private String type;
private WStepConfig config; // binder depending on type
}