thrifty-maven-plugin
所属分类:微服务
开发工具:Java
文件大小:0KB
下载次数:0
上传日期:2022-04-23 20:54:05
上 传 者:
sh-1993
说明: 将节俭编译器作为Maven插件的瘦包装器,
(Thin wrapper around thrifty-compiler as a Maven plugin,)
文件列表:
.travis.yml (112, 2022-04-23)
CHANGELOG.md (518, 2022-04-23)
LICENSE.txt (11357, 2022-04-23)
pom.xml (7157, 2022-04-23)
src/ (0, 2022-04-23)
src/main/ (0, 2022-04-23)
src/main/java/ (0, 2022-04-23)
src/main/java/com/ (0, 2022-04-23)
src/main/java/com/github/ (0, 2022-04-23)
src/main/java/com/github/timvlaer/ (0, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/ (0, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/CopyThriftFilesToClasses.java (2966, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/GlobalFlags.java (185, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/ThriftyCompilerMojo.java (2681, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/ (0, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/BuilderGetterMethodsTypeProcessor.java (1374, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/BuilderMethodsTypeProcessor.java (2221, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/DelegatingTypeProcessor.java (737, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/TaggedUnionMethodTypeProcessor.java (3672, 2022-04-23)
src/main/java/com/github/timvlaer/thrifty/plugin/TypeSpecUtil.java (1282, 2022-04-23)
src/main/resources/ (0, 2022-04-23)
src/main/resources/META-INF/ (0, 2022-04-23)
src/main/resources/META-INF/services/ (0, 2022-04-23)
src/main/resources/META-INF/services/com.microsoft.thrifty.compiler.spi.TypeProcessor (58, 2022-04-23)
src/test/ (0, 2022-04-23)
src/test/java/ (0, 2022-04-23)
src/test/java/com/ (0, 2022-04-23)
src/test/java/com/github/ (0, 2022-04-23)
src/test/java/com/github/timvlaer/ (0, 2022-04-23)
src/test/java/com/github/timvlaer/thrifty/ (0, 2022-04-23)
src/test/java/com/github/timvlaer/thrifty/ThriftyCompilerMojoTest.java (5252, 2022-04-23)
src/test/resources/ (0, 2022-04-23)
src/test/resources/include.thrift (89, 2022-04-23)
src/test/resources/testcase.thrift (158, 2022-04-23)
src/test/resources/union.thrift (257, 2022-04-23)
# thrifty-maven-plugin
[![Build Status](https://www.travis-ci.org/timvlaer/thrifty-maven-plugin.svg?branch=master)](https://www.travis-ci.org/timvlaer/thrifty-maven-plugin)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.timvlaer/thrifty-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.timvlaer/thrifty-maven-plugin)
Thin wrapper around the [thrifty-compiler](https://github.com/microsoft/thrifty/tree/master/thrifty-compiler).
This maven plugin generates the placeholder code for a thrift IDL file
using the [thrifty](https://github.com/microsoft/thrifty) library.
Advantages of using Thrifty over the regular Thrift distribution for Java code generation:
* All compilation happens on the JVM, no need to install Thrift binaries.
* Thrifty generates better java code: immutable objects with builders.
* Thrifty has a smaller footprint, the generated byte code is perfectly compatible.
## Usage
Add the following plugin to the `
` part of your Maven pom.xml file
```xml
com.github.timvlaer
thrifty-maven-plugin
0.8.0
thrift-schema/internal.thrift
true
false
thrifty-compiler
```
The generated code depends on `thrifty-runtime`, so add the following to your dependency list.
```xml
com.microsoft.thrifty
thrifty-runtime
3.0.0
```
## Java 9 and above
Add the `maven.compiler.release` property to the pom.xml file. The plugin will pick this up and configure Thrifty accordingly.
```xml
11
```
## Generated convenience methods
This Maven plugin generates extra methods if you set `` to `true` (default is `false`).
On all classes:
* `public static Builder builder()`, as a shortcut to `new StructName.Builder()`
* `public static Builder builder(StructName prototype)`, as a shortcut to `new StructName.Builder(struct)`
* `public Builder toBuilder()`, as a shortcut to `new StructName.Builder(struct)`
On classes that are based on Thrift `union` types:
* `public String tag()` which returns the name of the filled field
* `public Object value()` which returns the value of the filled field (untyped)
* For each union field, a static factory method, e.g. `public static UnionName unionValue(String unionValue)`
If you set `` to `true`, this plugin will generate getter methods on builders.
This might ease migration from the default (mutable) thrift generated code.
[Effective Java](https://www.goodreads.com/book/show/34927404-effective-java) doesn't recommend Getters on builders,
so the default for this setting is `false`.
近期下载者:
相关文件:
收藏者: