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

mybatis / velocity-scripting / #375

24 Sep 2023 01:30AM CUT coverage: 82.545%. Remained the same
#375

Pull #187

github

web-flow
Merge 833f74f79 into df890ab13
Pull Request #187: Update dependency org.mybatis:mybatis-parent to v39

506 of 613 relevant lines covered (82.54%)

0.83 hits per line

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

88.89
/src/main/java/org/mybatis/scripting/velocity/VelocityLanguageDriver.java
1
/*
2
 *    Copyright 2012-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.scripting.velocity;
17

18
import org.apache.ibatis.executor.parameter.ParameterHandler;
19
import org.apache.ibatis.mapping.BoundSql;
20
import org.apache.ibatis.mapping.MappedStatement;
21
import org.apache.ibatis.mapping.SqlSource;
22
import org.apache.ibatis.parsing.XNode;
23
import org.apache.ibatis.scripting.LanguageDriver;
24
import org.apache.ibatis.scripting.defaults.DefaultParameterHandler;
25
import org.apache.ibatis.session.Configuration;
26

27
/**
28
 * The {@link LanguageDriver} using Velocity.
29
 * <p>
30
 * This class rename from {@code Driver}.
31
 * </p>
32
 *
33
 * @since 2.1.0
34
 *
35
 * @author Kazuki Shimizu
36
 */
37
public class VelocityLanguageDriver implements LanguageDriver {
38

39
  /**
40
   * Default constructor.
41
   */
42
  public VelocityLanguageDriver() {
43
    this(VelocityLanguageDriverConfig.newInstance());
1✔
44
  }
1✔
45

46
  /**
47
   * Constructor.
48
   *
49
   * @param driverConfig
50
   *          a language driver configuration
51
   */
52
  public VelocityLanguageDriver(VelocityLanguageDriverConfig driverConfig) {
1✔
53
    VelocityFacade.initialize(driverConfig);
1✔
54
  }
1✔
55

56
  /**
57
   * {@inheritDoc}
58
   */
59
  @Override
60
  public ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject,
61
      BoundSql boundSql) {
62
    return new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
1✔
63
  }
64

65
  /**
66
   * {@inheritDoc}
67
   */
68
  @Override
69
  public SqlSource createSqlSource(Configuration configuration, XNode script, Class<?> parameterTypeClass) {
70
    return new SQLScriptSource(configuration, script.getNode().getTextContent(),
1✔
71
        parameterTypeClass == null ? Object.class : parameterTypeClass);
1✔
72
  }
73

74
  /**
75
   * {@inheritDoc}
76
   */
77
  @Override
78
  public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterTypeClass) {
79
    return new SQLScriptSource(configuration, script, parameterTypeClass == null ? Object.class : parameterTypeClass);
×
80
  }
81

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