Code Monkey home page Code Monkey logo

Comments (5)

tasomaniac avatar tasomaniac commented on September 25, 2024 1

asMap sounds good. 👍

The backstory is: I needed to simply access values. Instead I had to iterate over keys and collect values. Although not too hard, it would be much simpler to use already available Map methods. I could just add values() method but I feel like this is just an example. I believe it would be handy to have full Map interface.

I think asMap is a good compromise to have both. I like the idea.

from gradle-build-properties-plugin.

tasomaniac avatar tasomaniac commented on September 25, 2024

I was gonna do this simply by using @Delegate annotation from groovy. With this, it is actually pretty simple change. Except for the defaults. This forced me to have a wrapper implementation of a simple map.

But at the same time I realized that there is an ongoing work on #35. That's why I decided to wait for that to finish.

Also opened this issue for discussion.

from gradle-build-properties-plugin.

mr-archano avatar mr-archano commented on September 25, 2024

As discussed IRL the reason why the plugin defines Entries as interface is to stay away from the mutability of the Map contract. To ensure immutability then we expose just 3 methods:

  • boolean contains(String key)
  • Entry getAt(String key)
  • Enumeration<String> getKeys()

I've been thinking about this and I still don't like the idea of using map there just to use some extension on Entries (I'm not worried about how hard or simple is to make Entries implement Map, but rather how this breaks the original idea of immutable set of lazy-evaluated entries).

We have 2 alternatives:

  • manually add the missing extensions to Entries to provide all the convenience methods missing
  • expose a Map<String, Entry> asMap() method that can be used to tap into the collection extensions from groovy without breaking the original idea.

@devisnik thoughts on this?

from gradle-build-properties-plugin.

mr-archano avatar mr-archano commented on September 25, 2024

Looking forward to the PR 😛

from gradle-build-properties-plugin.

mr-archano avatar mr-archano commented on September 25, 2024

Addressed by #43

from gradle-build-properties-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.