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

mybatis / ibatis-2 / 582

26 May 2025 08:10PM UTC coverage: 65.509% (-0.009%) from 65.518%
582

Pull #289

github

web-flow
Merge b3e816f00 into 6594639fe
Pull Request #289: Small code cleanups

1608 of 2812 branches covered (57.18%)

12 of 20 new or added lines in 6 files covered. (60.0%)

1 existing line in 1 file now uncovered.

5073 of 7744 relevant lines covered (65.51%)

0.66 hits per line

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

76.92
/src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/IsEmptyTagHandler.java
1
/*
2
 * Copyright 2004-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 com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements;
17

18
import com.ibatis.common.beans.Probe;
19
import com.ibatis.common.beans.ProbeFactory;
20

21
import java.lang.reflect.Array;
22
import java.util.Collection;
23

24
/**
25
 * The Class IsEmptyTagHandler.
26
 */
27
public class IsEmptyTagHandler extends ConditionalTagHandler {
1✔
28

29
  /** The Constant PROBE. */
30
  private static final Probe PROBE = ProbeFactory.getProbe();
1✔
31

32
  @Override
33
  public boolean isCondition(SqlTagContext ctx, SqlTag tag, Object parameterObject) {
34
    if (parameterObject == null) {
1!
35
      return true;
×
36
    } else {
37
      String prop = getResolvedProperty(ctx, tag);
1✔
38
      Object value;
39
      if (prop != null) {
1✔
40
        value = PROBE.getObject(parameterObject, prop);
1✔
41
      } else {
42
        value = parameterObject;
1✔
43
      }
44
      if (value instanceof Collection) {
1!
NEW
45
        return ((Collection) value).isEmpty();
×
46
      } else if (value != null && value.getClass().isArray()) {
1!
47
        return Array.getLength(value) == 0;
×
48
      } else {
49
        return value == null || String.valueOf(value).equals("");
1✔
50
      }
51
    }
52
  }
53

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