Skip to content

NextPlugins/data-converter

Repository files navigation

data-converter

Codacy Badge

Essentialy, it was created to help convert data of a plugin from an other. But, we made it a adapter which can be used as a converter too.

How to use

Let's use it as a adapter.

That's my class:

class User {
  
  private final int id;
  private final String name;
  
  User(int id, String name) {
    this.id = id;
    this.name = name;
  }

  // Getters...

}

Let's adapt the data from database to a object:

Converter.<User>builder()
       .connection(myConnectionHere)
       .create()
       .request("SELECT `id`, `name` FROM `users` WHERE `id` = '1'")
       .convert((resultSet) -> new User(resultSet.get("id"), resultSet.get("name"))
       .responseEach((user) -> System.out.printf("My ID | My Name: %s | %s", user.getId(), user.getName()));

About

A lib to data conversion from a plugin to another.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages