Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danilodeluca/linebuilder

Its a simple way to create lines, when you need to set variables in certain "index of the line", easy to use. Feel free to open issues and request a PR!!
https://github.com/danilodeluca/linebuilder

Last synced: 7 days ago
JSON representation

Its a simple way to create lines, when you need to set variables in certain "index of the line", easy to use. Feel free to open issues and request a PR!!

Awesome Lists containing this project

README

        

A simple linebuilder.

Checkout tests to see how it works, its not difficult!!

## Example:
1. Simple line with 1 column and 4 lenght character

``` java
String build = new LineBuilder(4)
.column("test").at(1, 4).value("test")
.build();
```

Result:
``` java
Assert.assertEquals("test", build);
```

2. Line with 2 columns and 9 lenght character

``` java
String build = new LineBuilder(9)
.column("test").at(1, 4).value("test")
.column("test2").at(5, 9).value("test2")
.build();
```

Result:
``` java
Assert.assertEquals("testtest2", build);
```


3. Line with 1 columns and 4 lenght character and defined a complementer to left that will not be used

``` java
String build = new LineBuilder(4)
.complementColumn(Complementer.onLeft("|"))
.column("test").at(1, 4).value("test")
.build();
```

Result:
``` java
Assert.assertEquals("test", build);
```


4. Line with 1 columns and 5 lenght character and defined a complementer to left that will be used

``` java
String build = new LineBuilder(5)
.complementColumn(Complementer.onLeft("|"))
.column("test").at(1, 5).value("test")
.build();
```

Result:
``` java
Assert.assertEquals("|test", build);
```

5. Line with 1 columns and 5 lenght character and defined a complementer to right that will be used

``` java
String build = new LineBuilder(5)
.complementColumn(Complementer.onRight("|"))
.column("test").at(1, 5).value("test")
.build();
```

Result:
``` java
Assert.assertEquals("test|", build);
```