GithubHelp home page GithubHelp logo

jtoml's People

Contributors

asafh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dredhorse weexp

jtoml's Issues

Support deserializing fields/objects to enum values

KeyGroup fix and add:

public <T extends Enum> getAsEnum(String key, Class<T> clz) {  
  return Enum.valueOf(clz,getString(key));
}  

ObjectDeserializer in createField, check if type is enum call getAsEnum else same logic.

Traversing a TOML structure that is not known a priori

Is it possible to traverse a TOML structure that is not known a priori?

E.g. I have a file whose structure looks likes this:

["unknown-string-1"]
channel_id = "foo"
keywords = ["foo, foo"]

["unknown-string-2"]
channel_id = "bar"
keywords = ["bar, bar"]

I don't know the table names. Is it possible to iterate over the tables and access their names?

Maven Central

It would be fantastic if jtoml would be available in maven central soon. At the moment no (competing) TOML library is available in maven central, so this would be a great opportunity to become the de-facto Java toml library :)

Fails to parse single quotes

The following file

name = 'bob'

Fails with this exception

Exception in thread "main" io.ous.jtoml.ParseException: Could not identify value 'bob'
    at io.ous.jtoml.impl.ConsumableType.readValue(ConsumableType.java:38)
    at io.ous.jtoml.impl.Parser.onAssignment(Parser.java:96)
    at io.ous.jtoml.impl.Parser.onLine(Parser.java:61)
    at io.ous.jtoml.impl.Parser.parse(Parser.java:43)
    at io.ous.jtoml.JToml.parse(JToml.java:33)
    at io.ous.jtoml.JToml.parse(JToml.java:21)
    at io.ous.jtoml.JToml.parse(JToml.java:18)
    at org.thelq.pircbotx.TomlTest.main(TomlTest.java:19)

Remove IOException from JToml.parseString

JToml.parseString will actually not throw an IOException. It seems to make sense to remove "throws IOException" from the method. It won't make any binary break, but requires source code changes when recompiling the clients.

Fails to parse [[multientry]] sections

Attempting to parse the following file

[[servers]]
name = "server1"

[[servers]]
name = "server2"

Throws this during parsing

Exception in thread "main" io.ous.jtoml.ParseException: Cannot overwrite key [servers]
    at io.ous.jtoml.impl.Parser.onKeygroup(Parser.java:118)
    at io.ous.jtoml.impl.Parser.onLine(Parser.java:58)
    at io.ous.jtoml.impl.Parser.parse(Parser.java:43)
    at io.ous.jtoml.JToml.parse(JToml.java:33)
    at io.ous.jtoml.JToml.parse(JToml.java:21)
    at io.ous.jtoml.JToml.parse(JToml.java:18)
    at org.thelq.pircbotx.TomlTest.main(TomlTest.java:19)

This is valid TOML according to the toml standard readme: https://github.com/toml-lang/toml

exception occurred

println JToml.parseString('dob=1979-05-27T07:32:00-08:00').getDate('dob')
Caught: io.ous.jtoml.ParseException: Extra characters at -05-27T07:32:00-08:00
io.ous.jtoml.ParseException: Extra characters at -05-27T07:32:00-08:00
    at io.ous.jtoml.impl.Parser.onAssignment(Parser.java:99)
    at io.ous.jtoml.impl.Parser.onLine(Parser.java:61)
    at io.ous.jtoml.impl.Parser.parse(Parser.java:43)
    at io.ous.jtoml.JToml.parse(JToml.java:33)
    at io.ous.jtoml.JToml.parseString(JToml.java:26)
    at io.ous.jtoml.JToml$parseString.call(Unknown Source)
    at jtoml2.run(app.groovy:18)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

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.