2 Star 7 Fork 6

CHMing / data-converter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

📚简介

Data-Converter是一个支持多种数据格式协议的数据转换组件


🛠️支持协议及相关模块

模块 协议 引用模块
data-converter-fastjson JSON com.alibaba:fastjson:version
data-converter-fastjson2-json JSON com.alibaba.fastjson2:fastjson2:version
data-converter-fastjson2-jsonb JSONB com.alibaba.fastjson2:fastjson2:version
data-converter-gson JSON com.google.code.gson:gson:version
data-converter-jackson-json JSON com.fasterxml.jackson.core:jackson-core:version
com.fasterxml.jackson.core:jackson-databind:version
com.fasterxml.jackson.core:jackson-annotations:version
data-converter-jackson-xml Xml com.fasterxml.jackson.dataformat:jackson-dataformat-xml:version
data-converter-avro Avro org.apache.avro:avro:version
data-converter-hessian Hessian com.caucho:hessian:version
data-converter-kryo Kryo com.esotericsoftware:kryo:version
data-converter-protobuf Protobuf com.google.protobuf:protobuf-java:version
io.protostuff:protostuff-core:version
data-converter-protostuff Protostuff io.protostuff:protostuff-core:version
data-converter-fst Fst de.ruedigermoeller:fst:version
data-converter-jackson-msgpack Msgpack org.msgpack:jackson-dataformat-msgpack:version
data-converter-spearal Spearal org.spearal:spearal-java:version
data-converter-thrift Thrift org.apache.thrift:thrift:version
data-converter-jackson-yaml Yaml com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:version
data-converter-jackson-cbor Cbor com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:version
data-converter-jackson-ion Ion com.fasterxml.jackson.dataformat:jackson-dataformat-ion:version
data-converter-jackson-smile Smile com.fasterxml.jackson.dataformat:jackson-dataformat-smile:version

可以根据需求对每个模块单独引入,也可以通过引入data-converter-all方式引入所有模块。


📦安装

🍊Maven

在项目的pom.xml的dependencies中引入all模块:


<dependency>
    <groupId>io.gitee.chming7</groupId>
    <artifactId>data-converter-all</artifactId>
    <version>Version</version>
</dependency>

使用bom模块的方式引入

import方式

在父模块中加入


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.gitee.chming7</groupId>
            <artifactId>data-converter-bom</artifactId>
            <version>Version</version>
            <type>pom</type>
            <!-- 注意这里是import -->
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

在子模块中引入自己需要的模块


<dependencies>
    <dependency>
        <groupId>io.gitee.chming7</groupId>
        <artifactId>data-converter-gson</artifactId>
    </dependency>
</dependencies>

exclude方式

如果你引入的模块比较多,但是某几个模块没用,你可以


<dependencies>
    <dependency>
        <groupId>io.gitee.chming7</groupId>
        <artifactId>data-converter-bom</artifactId>
        <version>Version</version>
        <!-- 加不加这句都能跑,区别只有是否告警  -->
        <type>pom</type>
        <exclusions>
            <exclusion>
                <groupId>io.gitee.chming7</groupId>
                <artifactId>data-converter-avro</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

🍐Gradle

方式一:引入所有模块

implementation ("io.gitee.chming7:data-converter-all:Version")

方式二:引入自己需要的模块

implementation enforcedPlatform('io.gitee.chming7:data-converter-bom:Version')
implementation ("io.gitee.chming7:data-converter-gson")

方式三:排除不需要的模块

implementation enforcedPlatform('io.gitee.chming7:data-converter-bom:Version')
implementation ("io.gitee.chming7:data-converter-bom"){
    exclude module: "data-converter-json"
}

📥下载jar

点击以下链接,搜索下载data-converter-xxx-X.X.X.jar即可:

🚽编译安装

访问Data-converter的Gitee主页:Gitee 下载整个项目源码(master分支)然后进入Data-Converter项目目录执行:

gradle install

然后就可以使用Maven引入了。


📝简单示例

JsonConverter converter=ConverterSelector.select(JsonConverter.class);
// 或者
JsonConverter converter=JsonConverter.select();
// 序列化
String encode=converter.encode(user);
// 反序列化
User newUser=converter.convertToJavaObject(encode,User.class);

🏗️添砖加瓦

🐞提供bug反馈或建议

提交问题反馈请说明正在使用的JDK版本呢、Data-Converter版本和相关依赖库版本。

⛽贡献代码的步骤


  1. 提issue,如果在gitee的issue中已经有您想解决的问题,可以直接将该issue分配给您自己。如若没有,可以自己在gitee上创建一个issue。
  2. Fork 本项目的仓库
  3. 新建分支,如果是加新特性,分支名格式为feat_${issue的ID号},如果是修改bug,则命名为fix_${issue的ID号}
  4. 本地自测,提交前请通过所有的已经单元测试,以及为您要解决的问题新增单元测试。
  5. 提交代码
  6. 新建 Pull Request
  7. 我会对您的PR进行验证和测试,如通过测试,我会合到dev分支上随新版本发布时再合到master分支上。

项目协议

The MIT License (MIT)

Copyright (c) 2022 CHMing

The MIT License (MIT) Copyright (c) 2022 CHMing Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个支持多种数据格式协议的数据转换组件 展开 收起
Java
MIT
取消

发行版 (19)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/CHMing7/data-converter.git
git@gitee.com:CHMing7/data-converter.git
CHMing7
data-converter
data-converter
master

搜索帮助