Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Generate Maps and Array classes for raw types. #222

Open
spinillos opened this issue Jan 22, 2024 · 0 comments
Open

Java: Generate Maps and Array classes for raw types. #222

spinillos opened this issue Jan 22, 2024 · 0 comments

Comments

@spinillos
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant