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

Make JavaLayoutUtil a static Utility #18

Open
BenjaminKlatt opened this issue Jan 3, 2014 · 0 comments
Open

Make JavaLayoutUtil a static Utility #18

BenjaminKlatt opened this issue Jan 3, 2014 · 0 comments

Comments

@BenjaminKlatt
Copy link
Contributor

The JavaLayoutUtil class is a pure utility class. All methods are stateless and threadsafe.

In the current implementation, it is instantiated twice per resource. Once as private field in JavaSourceOrClassFileResource and once in the parent class JavaResource.

It would be better to follow the typical design of utility classes:

  • make the class final
  • make the constructor private
  • make the methods static
  • let the consumers call the static methods and not initializing any instances of JavaResource

While JavaSourceOrClassFileResource is a manually maintained class, JavaResource is generated by EMF Text an moving it into the manually maintained source folder is not a reasonable change.

The EMF Text code generation should be adapted to generate JavaLayoutUtil as a real utility class and generate JavaResource in such a way that it makes use of the static utlity methods.
I did identify the Utility class generator in EMF Text but not the generator for the concrete resource generator. So I hope the issue will find it's way when I leave it here.

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

No branches or pull requests

1 participant