Skip to content

Automatically import types

Eclipse Webmaster requested to merge github/fork/dbluhm/dataelement-imports into next

Created by: dbluhm

This PR adds automatic importing of DataField types when necessary to classes generated through DataElement. This results in cleaner generated classes (look more like something you'd actually write by hand) and also makes specifying defaults more straightforward (for instance, when the invoking a class that is imported, you can use the string new MyClass() instead of new com.example.MyClass()).

As a side effect of these changes, I removed generics from JavascriptValidator. This significantly simplified the resolution of imports as this previously required putting velocity variables that would later be evaluated and interpolated into the JavascriptValidator's type. The character used by velocity for string interpolation is $ which collides with java's internal representation of inner classes (i.e. java.util.Map.Entry can be expressed as java.util.Map$Entry) which is problematic for parsing out types to import.

Fixes #450 (closed).

Merge request reports