Some updates to make generated code cleaner and more readable

Some updates to make generated code cleaner and more readable, including avoiding generating methods that are not needed when conditions say they will not be used, ordering methods differently to let 'developer-relevant' methods be clustered, add javadoc comments, some named constants for readability, etc.