Skip to content

Commit

Permalink
add toString
Browse files Browse the repository at this point in the history
  • Loading branch information
Build Pipeline committed Sep 19, 2021
1 parent e0c7625 commit 0d42636
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/org/bsc/java2typescript/TSNamespace.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;

import static java.lang.String.format;

public class TSNamespace {

Expand All @@ -25,4 +28,11 @@ public Set<TSType> getTypes() {
public static TSNamespace of( String name, Set<TSType> types ) {
return new TSNamespace( name, types );
}

@Override
public String toString() {
return format( "TSNamespace: { name: '%s', types: [%s] }",
name, getTypes().stream()
.map( TSType::toString ).collect(Collectors.joining(",\n")) );
}
}
4 changes: 4 additions & 0 deletions core/src/main/java/org/bsc/java2typescript/TSType.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,8 @@ public int hashCode() {
return getValue().hashCode();
}

@Override
public String toString() {
return format("TSType{ value: %s }", getValue().getName());
}
}

0 comments on commit 0d42636

Please sign in to comment.