[Core] [File] Add csv file convert

This commit is contained in:
qianmoQ 2024-06-14 20:43:22 +08:00
parent 0a29a7ef0e
commit 836490cd40
6 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>2024.03.6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>datacap-file-csv</artifactId>
<description>DataCap - File for csv</description>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap-file-spi</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,28 @@
package io.edurt.datacap.file.csv
import io.edurt.datacap.file.File
import io.edurt.datacap.file.model.FileRequest
import io.edurt.datacap.file.model.FileResponse
class CsvFile : File
{
override fun format(request: FileRequest): FileResponse
{
TODO("Not yet implemented")
}
override fun formatStream(request: FileRequest): FileResponse
{
TODO("Not yet implemented")
}
override fun writer(request: FileRequest): FileResponse
{
TODO("Not yet implemented")
}
override fun reader(request: FileRequest): FileResponse
{
TODO("Not yet implemented")
}
}

View File

@ -0,0 +1,15 @@
package io.edurt.datacap.file.csv
import com.google.inject.multibindings.Multibinder
import io.edurt.datacap.file.File
import io.edurt.datacap.file.FileModule
class CsvModule : FileModule()
{
override fun configure()
{
Multibinder.newSetBinder(this.binder(), File::class.java)
.addBinding()
.to(CsvFile::class.java)
}
}

View File

@ -0,0 +1 @@
io.edurt.datacap.file.csv.CsvModule

View File

@ -0,0 +1,27 @@
package io.edurt.datacap.file.csv
import com.google.inject.Guice
import com.google.inject.Injector
import com.google.inject.Key
import com.google.inject.TypeLiteral
import io.edurt.datacap.file.File
import io.edurt.datacap.file.FileManager
import org.junit.Assert.assertEquals
import org.junit.Test
class CsvModuleTest
{
private val injector: Injector = Guice.createInjector(FileManager())
@Test
fun test()
{
injector.getInstance(Key.get(object : TypeLiteral<Set<File>>()
{}))
.stream()
.findFirst()
.ifPresent {
assertEquals("Csv", it.name())
}
}
}

View File

@ -93,6 +93,7 @@
<module>file/datacap-file-txt</module>
<module>file/datacap-file-json</module>
<module>file/datacap-file-none</module>
<module>file/datacap-file-csv</module>
</modules>
<name>datacap</name>