Coder Social home page Coder Social logo

Comments (3)

MrCrayfish avatar MrCrayfish commented on August 29, 2024

Due to type erasure, Configured does it's best to guess which type it is. For an empty list, it relies on the element validator to determine the type. If you simply return true in the element validator, Configured will assume it's the correct value. It just happens to be that Boolean is the first value tested. Basically ensure you have a strong element validator.

from configured.

connor135246 avatar connor135246 commented on August 29, 2024

Thanks for responding on Christmas Day!
But as I said in bottom of the first comment, the element validator doesn't exactly work here.
Here are more examples I tried using the element validator:
ConfigValue<List<? extends Integer>> emptyIntConfig1 = builder.defineList("empty int list 1", Arrays.<Integer> asList(), obj -> obj instanceof Integer);
ConfigValue<List<? extends Integer>> emptyIntConfig2 = builder.defineList("empty int list 2", Arrays.asList(), (obj) -> { try { Integer.parseInt(obj.toString()); return true; } catch (NumberFormatException excep) { return false; } });
ConfigValue<List<? extends String>> emptyStrConfig = builder.defineList("empty string list", new ArrayList<String>(), obj -> obj instanceof String);
None of these config options allow me to add values to the lists in the Configured GUI. On the Add... screen, the text I type turns red, and the Done button can't be pressed, no matter what I type.

from configured.

MrCrayfish avatar MrCrayfish commented on August 29, 2024

Fixed issue in e8c64d0
As for the config value defined in the steps, refer to my previous reply.

from configured.

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.