1 /***********************************************************************
2  * Copyright (c) 2013-2024 Commonwealth Computer Research, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Apache License, Version 2.0
5  * which accompanies this distribution and is available at
6  * http://www.opensource.org/licenses/apache2.0.php.
7  ***********************************************************************/
8 
9 package org.locationtech.geomesa.tools.utils
10 
11 import com.beust.jcommander.{IStringConverter, IStringConverterFactory}
12 
13 import java.util.regex.Pattern
14 
15 class GeoMesaIStringConverterFactory extends IStringConverterFactory {
16 
17   import GeoMesaIStringConverterFactory.ConverterMap
18 
19   override def getConverter(forType: Class[_]): Class[_ <: IStringConverter[_]] =
20     ConverterMap.getOrElse(forType, null)
21 }
22 
23 object GeoMesaIStringConverterFactory {
24   val ConverterMap: Map[Class[_], Class[_ <: IStringConverter[_]]] =
25     Map[Class[_], Class[_ <: IStringConverter[_]]](
26       classOf[Pattern] -> classOf[JPatternConverter]
27     )
28 }
29 
30 class JPatternConverter extends IStringConverter[Pattern] {
31   override def convert(value: String): Pattern = Pattern.compile(value)
32 }
Line Stmt Id Pos Tree Symbol Tests Code
20 80283 828 - 865 Apply scala.collection.MapLike.getOrElse GeoMesaIStringConverterFactory.ConverterMap.getOrElse[Class[_ <: com.beust.jcommander.IStringConverter[_]]](forType, null)
25 80285 982 - 1088 Apply scala.collection.generic.GenMapFactory.apply scala.Predef.Map.apply[Class[_], Class[_ <: com.beust.jcommander.IStringConverter[_]]](scala.Predef.ArrowAssoc[Class[java.util.regex.Pattern]](classOf[java.util.regex.Pattern]).->[Class[org.locationtech.geomesa.tools.utils.JPatternConverter]](classOf[org.locationtech.geomesa.tools.utils.JPatternConverter]))
26 80284 1036 - 1082 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[Class[java.util.regex.Pattern]](classOf[java.util.regex.Pattern]).->[Class[org.locationtech.geomesa.tools.utils.JPatternConverter]](classOf[org.locationtech.geomesa.tools.utils.JPatternConverter])
31 80286 1201 - 1223 Apply java.util.regex.Pattern.compile java.util.regex.Pattern.compile(value)