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

mybatis / ibatis-2 / 730

28 Dec 2025 10:16PM UTC coverage: 65.615% (+0.5%) from 65.146%
730

push

github

web-flow
Update README.md

1602 of 2802 branches covered (57.17%)

5053 of 7701 relevant lines covered (65.61%)

0.66 hits per line

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

83.33
/src/main/java/com/ibatis/sqlmap/engine/accessplan/PropertyAccessPlan.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.accessplan;
17

18
import com.ibatis.common.beans.ClassInfo;
19
import com.ibatis.common.beans.Invoker;
20

21
/**
22
 * Property access plan (for working with beans).
23
 */
24
public class PropertyAccessPlan extends BaseAccessPlan {
25

26
  /** The Constant NO_ARGUMENTS. */
27
  protected static final Object[] NO_ARGUMENTS = {};
1✔
28

29
  /** The setters. */
30
  protected Invoker[] setters;
31

32
  /** The getters. */
33
  protected Invoker[] getters;
34

35
  /**
36
   * Instantiates a new property access plan.
37
   *
38
   * @param clazz
39
   *          the clazz
40
   * @param propertyNames
41
   *          the property names
42
   */
43
  PropertyAccessPlan(Class clazz, String[] propertyNames) {
44
    super(clazz, propertyNames);
1✔
45
    setters = getSetters(propertyNames);
1✔
46
    getters = getGetters(propertyNames);
1✔
47
  }
1✔
48

49
  @Override
50
  public void setProperties(Object object, Object[] values) {
51
    int i = 0;
1✔
52
    try {
53
      Object[] arg = new Object[1];
1✔
54
      for (i = 0; i < propertyNames.length; i++) {
1✔
55
        arg[0] = values[i];
1✔
56
        try {
57
          setters[i].invoke(object, arg);
1✔
58
        } catch (Throwable t) {
×
59
          throw ClassInfo.unwrapThrowable(t);
×
60
        }
1✔
61
      }
62
    } catch (Throwable t) {
×
63
      throw new RuntimeException(
×
64
          "Error setting property '" + setters[i].getName() + "' of '" + object + "'.  Cause: " + t, t);
×
65
    }
1✔
66
  }
1✔
67

68
  @Override
69
  public Object[] getProperties(Object object) {
70
    int i = 0;
1✔
71
    Object[] values = new Object[propertyNames.length];
1✔
72
    try {
73
      for (i = 0; i < propertyNames.length; i++) {
1✔
74
        try {
75
          values[i] = getters[i].invoke(object, NO_ARGUMENTS);
1✔
76
        } catch (Throwable t) {
1✔
77
          throw ClassInfo.unwrapThrowable(t);
1✔
78
        }
1✔
79
      }
80
    } catch (Throwable t) {
1✔
81
      throw new RuntimeException(
1✔
82
          "Error getting property '" + getters[i].getName() + "' of '" + object + "'.  Cause: " + t, t);
1✔
83
    }
1✔
84
    return values;
1✔
85
  }
86

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