All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flextrade.jfixture.internal.ScalaPrimitivesBuilder.scala Maven / Gradle / Ivy

package com.flextrade.jfixture.internal

import com.flextrade.jfixture.{NoSpecimen, SpecimenBuilder, SpecimenContext}

import scala.reflect.runtime.universe.{runtimeMirror, Type => ScalaType}

class ScalaPrimitivesBuilder extends SpecimenBuilder {

  private val mirror = runtimeMirror(classOf[ScalaPrimitivesBuilder].getClassLoader)

  override def create(request: Any, context: SpecimenContext): AnyRef = {
    request match {
      case tpe: ScalaType => context.resolve(mirror.runtimeClass(tpe.typeSymbol.asClass))
      case _ => new NoSpecimen
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy