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

mybatis / scala / 444

29 Mar 2025 10:33PM CUT coverage: 0.0%. Remained the same
444

push

github

web-flow
Update ci.yaml

drop jdk 22 and 23-ea, add jdk 24

0 of 476 branches covered (0.0%)

0 of 996 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/mybatis-scala-core/src/main/scala/org/mybatis/scala/config/ObjectWrapperFactory.scala
1
/*
2
 *    Copyright 2011-2015 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.scala.config
17

18
import org.apache.ibatis.reflection.MetaObject
19
import org.apache.ibatis.reflection.property.PropertyTokenizer
20
import org.apache.ibatis.reflection.factory.{ObjectFactory => XObjectFactory}
21

22
abstract class CollectionObjectWrapper extends org.apache.ibatis.reflection.wrapper.ObjectWrapper {
×
23
  def get(prop : PropertyTokenizer) : AnyRef = null
×
24
  def set(prop : PropertyTokenizer, value : AnyRef) : Unit = {}
25
  def findProperty(name : String, useCamelCaseMapping : Boolean) : String = null
×
26
  def getGetterNames() : Array[String] = null
×
27
  def getSetterNames() : Array[String] = null
×
28
  def getSetterType(name : String) : Class[_] = null
×
29
  def getGetterType(name : String) : Class[_] = null
×
30
  def hasSetter(name : String) : Boolean = false
×
31
  def hasGetter(name : String) : Boolean = false
×
32
  def instantiatePropertyValue(name : String, prop : PropertyTokenizer, objectFactory : XObjectFactory) : MetaObject = null
×
33
  def isCollection() : Boolean = true
×
34
}
35

36
class ArrayBufferWrapper(buffer : scala.collection.mutable.ArrayBuffer[AnyRef]) extends CollectionObjectWrapper {
×
37
  import scala.jdk.CollectionConverters._
38
  def add(element : AnyRef) : Unit = buffer append element
×
39
  def addAll[E](elements : java.util.List[E]) : Unit = buffer.addAll(elements.asInstanceOf[java.util.Collection[AnyRef]].asScala)
×
40
}
41

42
class HashSetWrapper(set : scala.collection.mutable.HashSet[AnyRef]) extends CollectionObjectWrapper {
×
43
  import scala.jdk.CollectionConverters._
44
  def add(element : AnyRef) : Unit = set add element
×
45
  def addAll[E](elements : java.util.List[E]) : Unit = set.addAll(elements.asInstanceOf[java.util.Collection[AnyRef]].asScala)
×
46
}
47

48
class DefaultObjectWrapperFactory extends ObjectWrapperFactory {
×
49
  def hasWrapperFor(obj : AnyRef) : Boolean = obj match {
×
50
    case o : scala.collection.mutable.ArrayBuffer[_] => true
×
51
    case o : scala.collection.mutable.HashSet[_] => true
×
52
    case _ => false
×
53
  }
54
  def getWrapperFor(metaObject : MetaObject, obj : AnyRef) : org.apache.ibatis.reflection.wrapper.ObjectWrapper = obj match {
×
55
    case o : scala.collection.mutable.ArrayBuffer[_] => new ArrayBufferWrapper(o.asInstanceOf[scala.collection.mutable.ArrayBuffer[AnyRef]])
×
56
    case o : scala.collection.mutable.HashSet[_] => new HashSetWrapper(o.asInstanceOf[scala.collection.mutable.HashSet[AnyRef]])
×
57
    case _ =>
58
      throw new IllegalArgumentException("Type not supported: " + obj.getClass.getSimpleName)
×
59
  }
60
}
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