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

mybatis / typehandlers-threeten-extra / #530

30 Sep 2024 07:56PM UTC coverage: 100.0%. Remained the same
#530

push

github

web-flow
Merge pull request #203 from mybatis/renovate/mockito-monorepo

Update mockito monorepo to v5.14.1

85 of 112 branches covered (75.89%)

105 of 105 relevant lines covered (100.0%)

1.0 hits per line

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

100.0
/src/main/java/org/mybatis/typehandlers/threetenextra/WeeksTypeHandler.java
1
/*
2
 *    Copyright 2017-2022 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.mybatis.typehandlers.threetenextra;
17

18
import java.sql.CallableStatement;
19
import java.sql.PreparedStatement;
20
import java.sql.ResultSet;
21
import java.sql.SQLException;
22

23
import org.apache.ibatis.type.BaseTypeHandler;
24
import org.apache.ibatis.type.JdbcType;
25
import org.threeten.extra.Weeks;
26

27
/**
28
 * Type handler for ThreeTen-Extra's {@link Weeks}.
29
 *
30
 * @author Björn Raupach
31
 */
32
public class WeeksTypeHandler extends BaseTypeHandler<Weeks> {
1✔
33

34
  @Override
35
  public void setNonNullParameter(PreparedStatement ps, int parameterIndex, Weeks weeks, JdbcType type)
36
      throws SQLException {
37
    ps.setInt(parameterIndex, weeks.getAmount());
1✔
38
  }
1✔
39

40
  @Override
41
  public Weeks getNullableResult(ResultSet rs, String columnName) throws SQLException {
42
    int weeks = rs.getInt(columnName);
1✔
43
    return weeks == 0 && rs.wasNull() ? null : Weeks.of(weeks);
1!
44
  }
45

46
  @Override
47
  public Weeks getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
48
    int weeks = rs.getInt(columnIndex);
1✔
49
    return weeks == 0 && rs.wasNull() ? null : Weeks.of(weeks);
1!
50
  }
51

52
  @Override
53
  public Weeks getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
54
    int weeks = cs.getInt(columnIndex);
1✔
55
    return weeks == 0 && cs.wasNull() ? null : Weeks.of(weeks);
1!
56
  }
57

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