节俭包括两个同名文件? [英] Thrift include two files with same name?

查看:107
本文介绍了节俭包括两个同名文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的结构:(命名空间是java)

I have this structure: (namespace is java)

package/common.thrift
common.thrift
fileA.thrift

我希望fileA.thrift同时包含common.thrift

I want fileA.thrift to include both common.thrift

include ".../package/common.thrift"
include "common.thrift"

struct A {
   1: common.Something something #From first file (no error)
   2: common.SomethingElse else  #This throws error.
}

节俭仅从首先指定的文件中读取内容 为了.有没有办法解决这个问题:common.thrift as common 这样我就可以区分它们.或唯一的解决方案是 不同的文件名

Thrift only reads content from the file specified first in order. Is there a way for this : common.thrift as common So that i can differentiate them. Or the only solution is to have different file names

推荐答案

节俭仅按顺序从首先指定的文件中读取内容

Thrift only reads content from the file specified first in order

不完全是.但是Thrift需要一个前缀来访问其中包含的内容.因为前缀是文件名,所以不能包含两个公用"文件而不会产生歧义.

Not quite. But Thrift needs a prefix to access things that are included. Because the prefix is the file name, you cannot have two "common" files included without producing ambiguities.

因此,问题的答案是不,你不能.

这篇关于节俭包括两个同名文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆