-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sania' of https://github.com/sania-16/zingg into sania
- Loading branch information
Showing
9 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
|
||
|
||
|
||
|
||
package zingg.common.client; | ||
|
||
import java.io.Serializable; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
common/core/src/test/java/zingg/common/core/util/CsvReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package zingg.common.core.util; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
|
||
public class CsvReader { | ||
protected List<? extends IFromCsv> records; | ||
IFromCsv creator; | ||
|
||
public CsvReader(IFromCsv creator){ | ||
records = new ArrayList<IFromCsv>(); | ||
this.creator = creator; | ||
} | ||
|
||
public List<? extends IFromCsv> getRecords(String file, boolean skipHeader) throws FileNotFoundException{ | ||
int lineno = 0; | ||
try (Scanner scanner = new Scanner(new File(file))) { | ||
while (scanner.hasNextLine()) { | ||
records.add(creator.fromCsv(scanner.nextLine())); | ||
} | ||
} | ||
return records; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
common/core/src/test/java/zingg/common/core/util/IFromCsv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package zingg.common.core.util; | ||
|
||
public interface IFromCsv { | ||
|
||
<C> C fromCsv(String s); | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...mmon/infra/util/PojoToArrayConverter.java → ...ommon/core/util/PojoToArrayConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters