forked from opensci/piflow
add findAllGroup api
This commit is contained in:
parent
ddf12a0e67
commit
a7a11bd5dc
|
@ -1,6 +1,7 @@
|
|||
package cn.piflow.bundle
|
||||
|
||||
import cn.piflow.bundle.csv.CsvParser
|
||||
import cn.piflow.conf.StopGroup
|
||||
import org.junit.Test
|
||||
|
||||
class StopGroupTest {
|
||||
|
@ -18,4 +19,11 @@ class StopGroupTest {
|
|||
csvParserStop.setProperties(csvParserParameters)
|
||||
println(csvParserStop.getGroup().toString)
|
||||
}
|
||||
|
||||
@Test
|
||||
def testFindAllGroup() = {
|
||||
|
||||
val group = StopGroup.findAllGroup()
|
||||
group.foreach(println)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package cn.piflow.conf
|
||||
|
||||
import scala.reflect.runtime.{universe => ru}
|
||||
sealed class StopGroup
|
||||
case object CommonGroup extends StopGroup
|
||||
case object CsvGroup extends StopGroup
|
||||
|
@ -10,3 +10,19 @@ case object XmlGroup extends StopGroup
|
|||
case object HttpGroup extends StopGroup
|
||||
case object FtpGroup extends StopGroup
|
||||
case object ScriptGroup extends StopGroup
|
||||
|
||||
object StopGroup{
|
||||
def findAllGroup(): List[String] ={
|
||||
var groupList : List[String] = List()
|
||||
val tpe = ru.typeOf[StopGroup]
|
||||
val clazz = tpe.typeSymbol.asClass
|
||||
clazz.knownDirectSubclasses.foreach(x => {
|
||||
val subObjectArray = x.toString.split(" ")
|
||||
groupList = subObjectArray(1) :: groupList})
|
||||
groupList
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ object ClassUtil {
|
|||
files ++ dir.listFiles().filter(_.isDirectory).flatMap(getJarFile)
|
||||
}
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
/*def main(args: Array[String]): Unit = {
|
||||
//val stop = findConfigurableStop("cn.piflow.bundle.Class1")
|
||||
val allConfigurableStopList = findAllConfigurableStop()
|
||||
println("\n\n\n" + allConfigurableStopList)
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue