• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alibaba / jetcache / #405

16 Apr 2024 05:58AM UTC coverage: 0.0% (-88.9%) from 88.866%
#405

push

areyouok
add encoding to fix coverage report

0 of 5353 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/jetcache-core/src/main/java/com/alicp/jetcache/support/JacksonKeyConvertor.java
1
/**
2
 * Created on  13-09-10 15:45
3
 */
4
package com.alicp.jetcache.support;
5

6
import com.fasterxml.jackson.core.JsonProcessingException;
7
import com.fasterxml.jackson.databind.ObjectMapper;
8

9
import java.util.function.Function;
10

11
/**
12
 * @author huangli
13
 */
14
public class JacksonKeyConvertor implements Function<Object, Object> {
×
15

16
    public static final JacksonKeyConvertor INSTANCE = new JacksonKeyConvertor();
×
17

18
    private static ObjectMapper objectMapper = new ObjectMapper();
×
19

20
    @Override
21
    public Object apply(Object originalKey) {
22
        if (originalKey == null) {
×
23
            return null;
×
24
        }
25
        if (originalKey instanceof CharSequence) {
×
26
            return originalKey.toString();
×
27
        }
28
        try {
29
            return objectMapper.writeValueAsString(originalKey);
×
30
        } catch (JsonProcessingException e) {
×
31
            throw new CacheEncodeException("jackson key convert fail", e);
×
32
        }
33
    }
34

35
}
36

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc