Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
3bb71060
Commit
3bb71060
authored
Jun 17, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename bizField getter、setter variable name
parent
5473de9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/biz/BizIdColumnField.java
...framework/autoconfigure/mybatis/biz/BizIdColumnField.java
+8
-12
No files found.
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/biz/BizIdColumnField.java
View file @
3bb71060
...
...
@@ -2,7 +2,7 @@ package com.schbrain.framework.autoconfigure.mybatis.biz;
import
com.schbrain.common.exception.BaseException
;
import
com.schbrain.framework.autoconfigure.mybatis.annotation.BizId
;
import
lombok.
Data
;
import
lombok.
Getter
;
import
java.lang.invoke.MethodHandle
;
import
java.lang.reflect.Field
;
...
...
@@ -13,7 +13,7 @@ import static java.lang.invoke.MethodHandles.*;
* @author liaozan
* @since 2023-03-23
*/
@
Data
@
Getter
public
class
BizIdColumnField
{
private
final
BizId
annotation
;
...
...
@@ -22,9 +22,9 @@ public class BizIdColumnField {
private
final
Class
<?>
fieldType
;
private
final
MethodHandle
bizIdFieldGetterMethodHandle
;
private
final
MethodHandle
getter
;
private
final
MethodHandle
bizIdFieldSetterMethodHandle
;
private
final
MethodHandle
setter
;
public
BizIdColumnField
(
Class
<?>
entityClass
,
Field
bizIdField
)
{
this
.
annotation
=
bizIdField
.
getAnnotation
(
BizId
.
class
);
...
...
@@ -32,8 +32,8 @@ public class BizIdColumnField {
this
.
fieldType
=
bizIdField
.
getType
();
try
{
Lookup
lookup
=
privateLookupIn
(
entityClass
,
lookup
());
this
.
bizIdFieldGetterMethodHandle
=
lookup
.
findGetter
(
entityClass
,
bizIdField
.
getName
(),
fieldType
);
this
.
bizIdFieldSetterMethodHandle
=
lookup
.
findSetter
(
entityClass
,
bizIdField
.
getName
(),
fieldType
);
this
.
getter
=
lookup
.
findGetter
(
entityClass
,
bizIdField
.
getName
(),
fieldType
);
this
.
setter
=
lookup
.
findSetter
(
entityClass
,
bizIdField
.
getName
(),
fieldType
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
throw
new
BaseException
(
e
.
getMessage
(),
e
);
}
...
...
@@ -42,7 +42,7 @@ public class BizIdColumnField {
@SuppressWarnings
(
"unchecked"
)
public
<
V
,
T
>
V
getValue
(
T
entity
)
{
try
{
return
(
V
)
bizIdFieldGetterMethodHandle
.
invoke
(
entity
);
return
(
V
)
getter
.
invoke
(
entity
);
}
catch
(
Throwable
e
)
{
throw
new
BaseException
(
e
.
getMessage
(),
e
);
}
...
...
@@ -50,14 +50,10 @@ public class BizIdColumnField {
public
<
V
,
T
>
void
setValue
(
T
entity
,
V
value
)
{
try
{
bizIdFieldSetterMethodHandle
.
invoke
(
entity
,
value
);
setter
.
invoke
(
entity
,
value
);
}
catch
(
Throwable
e
)
{
throw
new
BaseException
(
e
.
getMessage
(),
e
);
}
}
public
Class
<?>
getFieldType
()
{
return
fieldType
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment