• 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/YearQuarterTypeHandler.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.YearQuarter;
26

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

34
  @Override
35
  public void setNonNullParameter(PreparedStatement ps, int parameterIndex, YearQuarter yearQuarter, JdbcType type)
36
      throws SQLException {
37
    ps.setString(parameterIndex, yearQuarter.toString());
1✔
38
  }
1✔
39

40
  @Override
41
  public YearQuarter getNullableResult(ResultSet rs, String columnName) throws SQLException {
42
    String str = rs.getString(columnName);
1✔
43
    return getYearQuarter(str);
1✔
44
  }
45

46
  @Override
47
  public YearQuarter getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
48
    String str = rs.getString(columnIndex);
1✔
49
    return getYearQuarter(str);
1✔
50
  }
51

52
  @Override
53
  public YearQuarter getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
54
    String str = cs.getString(columnIndex);
1✔
55
    return getYearQuarter(str);
1✔
56
  }
57

58
  private static YearQuarter getYearQuarter(String str) {
59
    if (str != null) {
1✔
60
      return YearQuarter.parse(str);
1✔
61
    }
62
    return null;
1✔
63
  }
64

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