FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java/src/main/java/com/jsoniter/DefaultMapKeyDecoder.java at master · eason2017/java · GitHub
eason2017
/
java
Public
forked from
json-iterator/java
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
java
/
src
/
main
/
java
/
com
/
jsoniter
/
DefaultMapKeyDecoder.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
39 lines (32 loc) · 1.2 KB
Breadcrumbs
java
/
src
/
main
/
java
/
com
/
jsoniter
/
DefaultMapKeyDecoder.java
Copy path
File metadata and controls
39 lines (32 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package
com
.
jsoniter
;
import
com
.
jsoniter
.
spi
.*;
import
java
.
io
.
IOException
;
import
java
.
lang
.
reflect
.
Type
;
class
DefaultMapKeyDecoder
implements
MapKeyDecoder
{
public
static
MapKeyDecoder
registerOrGetExisting
(
Type
mapKeyType
) {
String
cacheKey
=
JsoniterSpi
.
getMapKeyDecoderCacheKey
(
mapKeyType
);
MapKeyDecoder
mapKeyDecoder
=
JsoniterSpi
.
getMapKeyDecoder
(
cacheKey
);
if
(
null
!=
mapKeyDecoder
) {
return
mapKeyDecoder
;
}
mapKeyDecoder
=
new
DefaultMapKeyDecoder
(
TypeLiteral
.
create
(
mapKeyType
));
JsoniterSpi
.
addNewMapDecoder
(
cacheKey
,
mapKeyDecoder
);
return
mapKeyDecoder
;
}
private
final
TypeLiteral
mapKeyTypeLiteral
;
private
DefaultMapKeyDecoder
(
TypeLiteral
mapKeyTypeLiteral
) {
this
.
mapKeyTypeLiteral
=
mapKeyTypeLiteral
;
}
@
Override
public
Object
decode
(
Slice
encodedMapKey
) {
JsonIterator
iter
=
JsonIteratorPool
.
borrowJsonIterator
();
iter
.
reset
(
encodedMapKey
);
try
{
return
iter
.
read
(
mapKeyTypeLiteral
);
}
catch
(
IOException
e
) {
throw
new
JsonException
(
e
);
}
finally
{
JsonIteratorPool
.
returnJsonIterator
(
iter
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL