Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
R
RatelApi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ratel
RatelApi
Commits
6a6fe0d3
Commit
6a6fe0d3
authored
Oct 21, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom for specialViewer
parent
fd811797
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
ForceFiledViewer.java
...n/java/com/virjar/ratel/api/inspect/ForceFiledViewer.java
+29
-1
No files found.
src/main/java/com/virjar/ratel/api/inspect/ForceFiledViewer.java
View file @
6a6fe0d3
...
@@ -166,6 +166,13 @@ public class ForceFiledViewer {
...
@@ -166,6 +166,13 @@ public class ForceFiledViewer {
return
subRet
;
return
subRet
;
}
}
String
className
=
input
.
getClass
().
getName
();
String
className
=
input
.
getClass
().
getName
();
Function
function
=
specialViewer
.
get
(
className
);
if
(
function
!=
null
)
{
//某些特殊的dump规则,不如jodaTime,dump内容没有意义
return
function
.
apply
(
input
);
}
if
(
skipDumpPackage
.
isSubPackage
(
className
)
&&
!
forceDumpPackage
.
isSubPackage
(
className
))
{
if
(
skipDumpPackage
.
isSubPackage
(
className
)
&&
!
forceDumpPackage
.
isSubPackage
(
className
))
{
//框架内部对象,不抽取,这可能导致递归过深,而且没有意义
//框架内部对象,不抽取,这可能导致递归过深,而且没有意义
return
null
;
return
null
;
...
@@ -279,10 +286,11 @@ public class ForceFiledViewer {
...
@@ -279,10 +286,11 @@ public class ForceFiledViewer {
return
fields
;
return
fields
;
}
}
private
static
final
ConcurrentMap
<
Class
,
Map
<
String
,
Field
>>
fieldCache
=
new
ConcurrentHashMap
<>();
private
static
final
ConcurrentMap
<
Class
<?>
,
Map
<
String
,
Field
>>
fieldCache
=
new
ConcurrentHashMap
<>();
private
static
PackageTrie
forceDumpPackage
=
new
PackageTrie
();
private
static
PackageTrie
forceDumpPackage
=
new
PackageTrie
();
private
static
PackageTrie
skipDumpPackage
=
new
PackageTrie
();
private
static
PackageTrie
skipDumpPackage
=
new
PackageTrie
();
private
static
PackageTrie
skipTranslatePackage
=
new
PackageTrie
();
private
static
PackageTrie
skipTranslatePackage
=
new
PackageTrie
();
private
static
Map
<
String
,
Function
>
specialViewer
=
new
ConcurrentHashMap
<>();
public
static
void
addForceViewConfig
(
String
basePackage
)
{
public
static
void
addForceViewConfig
(
String
basePackage
)
{
forceDumpPackage
.
addToTree
(
basePackage
);
forceDumpPackage
.
addToTree
(
basePackage
);
...
@@ -296,6 +304,22 @@ public class ForceFiledViewer {
...
@@ -296,6 +304,22 @@ public class ForceFiledViewer {
skipTranslatePackage
.
addToTree
(
basePackage
);
skipTranslatePackage
.
addToTree
(
basePackage
);
}
}
public
static
void
addSpecialViewer
(
String
clazz
,
Function
transformFunction
)
{
specialViewer
.
put
(
clazz
,
transformFunction
);
}
public
interface
Function
{
Object
apply
(
Object
o
);
}
private
static
Function
ToString
=
o
->
{
if
(
o
==
null
)
{
return
null
;
}
return
o
.
toString
();
};
static
{
static
{
addSkipViewConfig
(
"android"
);
addSkipViewConfig
(
"android"
);
addSkipViewConfig
(
"com.android"
);
addSkipViewConfig
(
"com.android"
);
...
@@ -322,5 +346,9 @@ public class ForceFiledViewer {
...
@@ -322,5 +346,9 @@ public class ForceFiledViewer {
addSKipTranslateConfig
(
"com.alibaba.fastjson"
);
addSKipTranslateConfig
(
"com.alibaba.fastjson"
);
addSKipTranslateConfig
(
"org.json"
);
addSKipTranslateConfig
(
"org.json"
);
addSKipTranslateConfig
(
"com.google.gson"
);
addSKipTranslateConfig
(
"com.google.gson"
);
addSpecialViewer
(
"org.joda.time.DateTime"
,
ToString
);
}
}
}
}
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