项目
在 GitHub 查看
airlift/drift
关于
An annotation-based Java library for creating Thrift serializable types and services.
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Drift
Drift is an easy-to-use, annotation-based Java library for creating Thrift clients and serializable types. The client library is similar to JAX-RS (HTTP Rest) and the serialization library is similar to JaxB (XML) and Jackson (JSON), but for Thrift.
Example
The following interface defines a client for a Scribe server:
@ThriftService
public interface Scribe
{
@ThriftMethod
ResultCode log(List<LogEntry> messages);
}
The log method above uses the LogEntry Thrift struct which is defined as follows:
@ThriftStruct
public class LogEntry
{
private final String category;
private final String message;
@ThriftConstructor
public LogEntry(String category, String message)
{
this.category = category;
this.message = message;
}
@ThriftField(1)
public String getCategory()
{
return category;
}
@ThriftField(2)
public String getMessage()
{
return message;
}
}
An instance of the Scribe client can be created using a DriftClientFactory:
// create a client
Scribe scribe = clientFactory.createDriftClient(Scribe.class);
// use client
scribe.log(Arrays.asList(new LogEntry("category", "message")));
Detailed Documentation
- Drift Codec -- Thrift type annotations and serialization
- Drift Client -- Thrift client usage
- Drift Server -- Thrift server usage
探索相关项目
加载中…