Currently we specify OpalForms using field names as strings. Invalid field names (e.g. <%= lclOF.text("LsatName", 20) %>) lead to runtime errors. I'd love to turn these into compile-time errors.
Suggestion: Each UserFacing has nested static enums for Fields, References, and Children. Then we can do <%= lclOF.text(Contact.SimpleFields.LAST_NAME, 20) %> and we'll know about typos or outright errors at compile time.
This would also probably be a good place to put information on nullability, maximum lengths, etc., since inspecting annotations is painful. (Currently, com.opal.FieldUtility helps with this, but it's still awkwardly inspecting annotations at runtime.)
Currently we specify OpalForms using field names as strings. Invalid field names (e.g.
<%= lclOF.text("LsatName", 20) %>
) lead to runtime errors. I'd love to turn these into compile-time errors.Suggestion: Each UserFacing has nested static enums for Fields, References, and Children. Then we can do
<%= lclOF.text(Contact.SimpleFields.LAST_NAME, 20) %>
and we'll know about typos or outright errors at compile time.This would also probably be a good place to put information on nullability, maximum lengths, etc., since inspecting annotations is painful. (Currently,
com.opal.FieldUtility
helps with this, but it's still awkwardly inspecting annotations at runtime.)