0

I'm working in code generator project with the use of Xtend2. I want to use global variable. Right now I'm using map for that purpose. Is there any possibilities to declare global variable instead of map?

dnit13
  • 2,478
  • 18
  • 35

1 Answers1

0

It's not entirely clear to me what a global variable means to you. You could use a static field in a class and access that, but in general I'd recommend to avoid these patterns and pass the necessary state into the methods that need it or hold it as local state in the instance that needs it.

Sebastian Zarnekow
  • 6,609
  • 20
  • 23