Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
e913d430
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e913d430
编写于
12月 20, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix target var error
上级
e0c4ea97
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
42 deletion
+9
-42
core/adapter/call/JavaCallListener.go
core/adapter/call/JavaCallListener.go
+9
-9
examples/interface_api/BlogRepositoryImpl.java
examples/interface_api/BlogRepositoryImpl.java
+0
-33
未找到文件。
core/adapter/call/JavaCallListener.go
浏览文件 @
e913d430
...
...
@@ -146,7 +146,6 @@ func (s *JavaCallListener) EnterLocalVariableDeclaration(ctx *parser.LocalVariab
typ
:=
ctx
.
GetChild
(
0
)
.
(
antlr
.
ParseTree
)
.
GetText
()
if
ctx
.
GetChild
(
1
)
!=
nil
{
if
ctx
.
GetChild
(
1
)
.
GetChild
(
0
)
!=
nil
&&
ctx
.
GetChild
(
1
)
.
GetChild
(
0
)
.
GetChild
(
0
)
!=
nil
{
variableName
:=
ctx
.
GetChild
(
1
)
.
GetChild
(
0
)
.
GetChild
(
0
)
.
(
antlr
.
ParseTree
)
.
GetText
()
localVars
[
variableName
]
=
typ
}
...
...
@@ -282,14 +281,6 @@ func (s *JavaCallListener) EnterMethodCall(ctx *parser.MethodCallContext) {
stopLine
:=
ctx
.
GetStop
()
.
GetLine
()
stopLinePosition
:=
startLinePosition
+
len
(
callee
)
// TODO: 处理链试调用
if
strings
.
Contains
(
targetType
,
"("
)
&&
strings
.
Contains
(
targetType
,
")"
)
&&
strings
.
Contains
(
targetType
,
"."
)
{
split
:=
strings
.
Split
(
targetType
,
"."
)
sourceTarget
:=
split
[
0
]
targetType
=
localVars
[
sourceTarget
]
}
fullType
:=
warpTargetFullType
(
targetType
)
if
targetType
==
"super"
{
targetType
=
currentClzExtend
...
...
@@ -333,6 +324,10 @@ func (s *JavaCallListener) EnterMethodCall(ctx *parser.MethodCallContext) {
methodMap
[
getMethodMapName
(
currentMethod
)]
=
method
}
func
isChainCall
(
targetType
string
)
bool
{
return
strings
.
Contains
(
targetType
,
"("
)
&&
strings
.
Contains
(
targetType
,
")"
)
&&
strings
.
Contains
(
targetType
,
"."
)
}
func
buildMethodNameForBuilder
(
ctx
*
parser
.
MethodCallContext
,
targetType
string
)
string
{
// TODO: refactor
if
reflect
.
TypeOf
(
ctx
.
GetParent
())
.
String
()
==
"*parser.ExpressionContext"
{
...
...
@@ -408,6 +403,11 @@ func parseTargetType(targetCtx string) string {
if
strings
.
HasSuffix
(
typeOf
,
"MethodCallContext"
)
{
targetType
=
currentClz
}
else
{
if
isChainCall
(
targetVar
)
{
split
:=
strings
.
Split
(
targetType
,
"."
)
targetVar
=
split
[
0
]
}
fieldType
:=
mapFields
[
targetVar
]
formalType
:=
formalParameters
[
targetVar
]
localVarType
:=
localVars
[
targetVar
]
...
...
examples/interface_api/BlogRepositoryImpl.java
浏览文件 @
e913d430
...
...
@@ -17,43 +17,10 @@ public class BlogRepositoryImpl implements BlogRepository {
private
final
BlogMapper
blogMapper
;
public
BlogRepositoryImpl
(
BlogMapper
blogMapper
)
{
this
.
blogMapper
=
blogMapper
;
}
@Override
public
void
save
(
Blog
blog
)
{
var
blogPO
=
BlogPO
.
of
(
blog
);
blogMapper
.
findById
(
blog
.
getId
().
toString
()).
ifPresentOrElse
(
po
->
blogMapper
.
update
(
blogPO
),
()
->
blogMapper
.
insert
(
blogPO
)
);
}
@Override
public
Optional
<
Blog
>
findById
(
UUID
id
)
{
return
blogMapper
.
findById
(
id
.
toString
()).
map
(
BlogPO:
:
toDomainModel
);
}
@Override
public
boolean
existsById
(
UUID
id
)
{
return
blogMapper
.
existsById
(
id
.
toString
());
}
@Override
public
void
deleteById
(
UUID
id
)
{
blogMapper
.
deleteById
(
id
.
toString
());
}
@Override
public
List
<
Blog
>
findAll
(
BlogCriteria
criteria
)
{
return
blogMapper
.
selectAllByCriteria
(
criteria
).
stream
().
map
(
BlogPO:
:
toDomainModel
).
collect
(
toList
());
}
@Override
public
long
count
(
BlogCriteria
criteria
)
{
return
blogMapper
.
countTotalByCriteria
(
criteria
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录