Implement getters/setters
See original GitHub issueI would like to have getters/setters all across the code.
This would allow to access (and modify) all those things that now have a getWhatever()
and setWhatever
method, like L.Map.getZoom()
and L.Map.setZoom()
e.g. instead of:
map.setZoom(map.getZoom() + 1);
one could do:
map.zoom++;
I guess some of the code would become much more simpler. The main downside is that getters/setters are part of the ECMAscript 5 standard, so IE8 is out. Other downside is that it seems that the only way to copy getters/setters from an L.Class.extend(mixin)
definition is to resort to the method described in #3464, which might affect performance.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Getter and Setter in Java - GeeksforGeeks
It sets the value for any variable used in a class's programs. and starts with the word “set” followed by the variable name....
Read more >Getters and Setters in Java Explained - freeCodeCamp
Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns ...
Read more >Significance of Getters and Setters in Java - Baeldung
Getters and Setters play an important role in retrieving and updating the value of a variable outside the encapsulating class.
Read more >Java Encapsulation and Getters and Setters - W3Schools
declare class variables/attributes as private; provide public get and set methods to access and update the value of a private variable. Get and...
Read more >Getters and Setters Methods in Java - CodeGym
In today's lesson, we'll talk about Getters and Setters in Java. ... He creates his own Main class, where he begins to use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not a fan of getters/setters, having used them in GL JS. They do all the work that’s happening under the hood implicitly, which often makes it much harder to debug. Lacking IE8 support is also a blocker for now.
Adding this to the v2 milestone, and since this would be a breaking change I will mark it as such.