Skip to content

Commit

Permalink
Make toString usage more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebind committed Apr 29, 2021
1 parent 8076a42 commit 280d44d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ build
out
*.class
*.iml
*.ipr
*.iws
.DS_Store
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ plugins {
}

allprojects {
apply plugin: 'idea'

group = 'com.widen.oss'
ext.repo = 'https://github.com/Widen/tabitha'

idea.module.iml {
beforeMerged { module ->
module.dependencies.clear()
}
}
}

subprojects {
Expand Down
11 changes: 11 additions & 0 deletions tabitha-core/src/main/java/com/widen/tabitha/Variant.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ public Optional<Double> getFloat() {
return Optional.empty();
}

/**
* Return a string representation of this variant value.
*
* All variant types can be converted to their appropriate string representation using this method. The string
* equivalent will maintain as much precision as possible and is suitable for writing a variant value to a text-only
* format, such as a CSV.
*
* @return String equivalent of this value.
*/
public abstract java.lang.String toString();

// Private to prevent extending with unbounded variant types.
private Variant() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public DelimitedRowWriter(OutputStream outputStream, DelimitedFormat format) {
public void write(List<Variant> cells) {
String[] cols = cells
.stream()
.map(Object::toString)
.map(Variant::toString)
.map(String.class::cast)
.toArray(String[]::new);

Expand Down

0 comments on commit 280d44d

Please sign in to comment.