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

mybatis / mybatis-3 / 2604

03 Jan 2025 10:00AM UTC coverage: 87.524% (+0.3%) from 87.177%
2604

Pull #3146

github

web-flow
Merge 60c1f5fea into 8ac3920af
Pull Request #3146: Shared ambiguity instance

3633 of 4401 branches covered (82.55%)

4 of 4 new or added lines in 1 file covered. (100.0%)

254 existing lines in 22 files now uncovered.

9569 of 10933 relevant lines covered (87.52%)

0.88 hits per line

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

60.0
/src/main/java/org/apache/ibatis/reflection/DefaultReflectorFactory.java
1
/*
2
 *    Copyright 2009-2025 the original author or authors.
3
 *
4
 *    Licensed under the Apache License, Version 2.0 (the "License");
5
 *    you may not use this file except in compliance with the License.
6
 *    You may obtain a copy of the License at
7
 *
8
 *       https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *    Unless required by applicable law or agreed to in writing, software
11
 *    distributed under the License is distributed on an "AS IS" BASIS,
12
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *    See the License for the specific language governing permissions and
14
 *    limitations under the License.
15
 */
16
package org.apache.ibatis.reflection;
17

18
import java.util.concurrent.ConcurrentHashMap;
19
import java.util.concurrent.ConcurrentMap;
20

21
public class DefaultReflectorFactory implements ReflectorFactory {
22
  private boolean classCacheEnabled = true;
1✔
23
  private final ConcurrentMap<Class<?>, Reflector> reflectorMap = new ConcurrentHashMap<>();
1✔
24

25
  public DefaultReflectorFactory() {
1✔
26
  }
1✔
27

28
  @Override
29
  public boolean isClassCacheEnabled() {
UNCOV
30
    return classCacheEnabled;
×
31
  }
32

33
  @Override
34
  public void setClassCacheEnabled(boolean classCacheEnabled) {
UNCOV
35
    this.classCacheEnabled = classCacheEnabled;
×
UNCOV
36
  }
×
37

38
  @Override
39
  public Reflector findForClass(Class<?> type) {
40
    if (classCacheEnabled) {
1!
41
      // synchronized (type) removed see issue #461
42
      return reflectorMap.computeIfAbsent(type, Reflector::new);
1✔
43
    }
UNCOV
44
    return new Reflector(type);
×
45
  }
46

47
}
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