-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
增加ProtoFileParser和ProtoFileGenerator
- Loading branch information
1 parent
f53725d
commit 5b5cf27
Showing
29 changed files
with
1,113 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
nop-rpc/nop-rpc-grpc/src/main/java/io/nop/rpc/grpc/GrpcConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package io.nop.rpc.grpc; | ||
|
||
public interface GrpcConstants { | ||
} |
22 changes: 20 additions & 2 deletions
22
nop-rpc/nop-rpc-model/src/main/java/io/nop/rpc/model/ApiMessageFieldModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
package io.nop.rpc.model; | ||
|
||
import io.nop.core.type.IGenericType; | ||
import io.nop.rpc.model._gen._ApiMessageFieldModel; | ||
import io.nop.xlang.xmeta.ISchema; | ||
import io.nop.xlang.xmeta.impl.SchemaImpl; | ||
import io.nop.xlang.xmeta.impl.SchemaNodeImpl; | ||
|
||
public class ApiMessageFieldModel extends _ApiMessageFieldModel{ | ||
public ApiMessageFieldModel(){ | ||
public class ApiMessageFieldModel extends _ApiMessageFieldModel implements IWithOptions { | ||
public ApiMessageFieldModel() { | ||
|
||
} | ||
|
||
public IGenericType getType() { | ||
ISchema schema = getSchema(); | ||
return schema == null ? null : schema.getType(); | ||
} | ||
|
||
public void setType(IGenericType type) { | ||
ISchema schema = getSchema(); | ||
if (schema == null) { | ||
schema = new SchemaImpl(); | ||
setSchema(schema); | ||
} | ||
((SchemaNodeImpl) schema).setType(type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
nop-rpc/nop-rpc-model/src/main/java/io/nop/rpc/model/IWithOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.nop.rpc.model; | ||
|
||
import java.util.List; | ||
|
||
public interface IWithOptions { | ||
String getDescription(); | ||
List<ApiOptionModel> getOptions(); | ||
} |
11 changes: 11 additions & 0 deletions
11
nop-rpc/nop-rpc-model/src/main/java/io/nop/rpc/model/RpcModelConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.nop.rpc.model; | ||
|
||
public interface RpcModelConstants { | ||
String EXT_PROTO_VERSION = "ext:protoVersion"; | ||
|
||
|
||
String PROTO_TYPE_EMPTY = "google.protobuf.Empty"; | ||
|
||
String PROTO_TYPE_ANY = "google.protobuf.Any"; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
nop-rpc/nop-rpc-model/src/main/java/io/nop/rpc/model/RpcModelErrors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.nop.rpc.model; | ||
|
||
import io.nop.api.core.exceptions.ErrorCode; | ||
|
||
import static io.nop.api.core.exceptions.ErrorCode.define; | ||
|
||
public interface RpcModelErrors { | ||
String ARG_VERSION = "version"; | ||
String ARG_PATH = "path"; | ||
|
||
ErrorCode ERR_RPC_UNSUPPORTED_PROTO_VERSION = | ||
define("nop.err.rpc.unsupported-proto-version", "不支持的协议版本: {version}", ARG_VERSION); | ||
|
||
ErrorCode ERR_RPC_INVALID_IMPORT_PATH = | ||
define("nop.err.rpc.invalid-import-path", "无效的导入路径: {path}", ARG_PATH); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.