cog
cog copied to clipboard
Java: Generate Maps and Array classes for raw types.
Java doesn't support interfaces.
The current solution is ignoring Maps and Arrays from the root files and when we found a field that uses a map or an array, we set their values instead.
For example:
#MyMap: [string]: String
#MyArray: [...string]
#Struct: {
myMap: #MyMap
myArray: #MyArray
}
Generates:
import java.util.Map;
import java.util.List;
public class Struct {
private Map<String, String> myMap;
private List<String> myArray;
}
But to avoid to loose these aliases, it could be nice if we can generate these maps and lists as classes that extends from LinkedHashMap
and LinkedList
. By this way, if any of them has default values, we can set them into their constructor.