Skip to content

Commit

Permalink
#270: Move wvlet.surface -> wvlet.airframe.surface (#272)
Browse files Browse the repository at this point in the history
* #270: Move wvlet.surface -> wvlet.airframe.surface
* Fix tagged type document
  • Loading branch information
xerial committed Oct 1, 2018
1 parent 6867642 commit 5ca3143
Show file tree
Hide file tree
Showing 84 changed files with 202 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package wvlet.airframe.codec
import java.util

import org.msgpack.core.{MessagePacker, MessageUnpacker}
import wvlet.surface.{Surface, Zero}
import wvlet.airframe.surface.{Surface, Zero}

import scala.collection.JavaConverters._
import scala.collection.mutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import CollectionCodec._

import wvlet.airframe.codec.ScalaStandardCodec.{OptionCodec, TupleCodec}
import wvlet.airframe.codec.StandardCodec.EnumCodec
import wvlet.surface
import wvlet.surface.reflect.{ReflectTypeUtil, SurfaceFactory}
import wvlet.surface.{EnumSurface, GenericSurface, Surface}
import wvlet.airframe.surface
import wvlet.airframe.surface.reflect.{ReflectTypeUtil, SurfaceFactory}
import wvlet.airframe.surface.{EnumSurface, GenericSurface, Surface}

import scala.reflect.runtime.{universe => ru}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package wvlet.airframe.codec
import org.msgpack.core.{MessagePack, MessagePacker, MessageUnpacker}
import org.msgpack.value.{ValueType, Variable}
import wvlet.log.LogSupport
import wvlet.surface.reflect.CName
import wvlet.surface.{Parameter, Surface, Zero}
import wvlet.airframe.surface.reflect.CName
import wvlet.airframe.surface.{Parameter, Surface, Zero}

import scala.util.{Failure, Success, Try}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package wvlet.airframe.codec

import org.msgpack.core.{MessageIntegerOverflowException, MessagePacker, MessageUnpacker}
import org.msgpack.value.ValueType
import wvlet.surface
import wvlet.surface.{Primitive, Surface}
import wvlet.airframe.surface
import wvlet.airframe.surface.{Primitive, Surface}

import scala.util.Try

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.msgpack.value.ValueType
import wvlet.airframe.msgpack.io.ByteArrayBuffer
import wvlet.airframe.msgpack.spi._
import wvlet.log.LogSupport
import wvlet.surface
import wvlet.surface.Surface
import wvlet.airframe.surface
import wvlet.airframe.surface.Surface

import scala.util.{Failure, Success, Try}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import PropertiesConfig.ConfigKey
import wvlet.airframe.config.YamlReader.loadMapOf
import wvlet.log.LogSupport
import wvlet.log.io.IOUtil
import wvlet.surface
import wvlet.surface.{Surface, Zero}
import wvlet.airframe.surface
import wvlet.airframe.surface.{Surface, Zero}

import scala.reflect.ClassTag
import scala.reflect.runtime.{universe => ru}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ package wvlet.airframe.config
import java.util.Properties

import wvlet.log.LogSupport
import wvlet.surface.CanonicalNameFormatter._
import wvlet.surface.reflect.ObjectBuilder
import wvlet.surface.{Surface, TaggedSurface}
import wvlet.airframe.surface.CanonicalNameFormatter._
import wvlet.airframe.surface.reflect.ObjectBuilder
import wvlet.airframe.surface.{Surface, TaggedSurface}

import scala.util.{Failure, Success, Try}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import wvlet.airframe.tablet.MessagePackRecord
import wvlet.airframe.tablet.obj.ObjectTabletWriter
import wvlet.log.LogSupport
import wvlet.log.io.IOUtil._
import wvlet.surface
import wvlet.surface.Surface
import wvlet.surface.reflect.ReflectTypeUtil
import wvlet.airframe.surface
import wvlet.airframe.surface.Surface
import wvlet.airframe.surface.reflect.ReflectTypeUtil

import scala.collection.JavaConverters._
import scala.collection.immutable.ListMap
Expand All @@ -42,7 +42,7 @@ object YamlReader extends LogSupport {
def loadMapOf[A: ru.TypeTag](resourcePath: String): Map[String, A] = {
val yaml = loadYaml(resourcePath)
trace(s"yaml data: ${yaml.mkString(", ")}")
val surface: Surface = wvlet.surface.of[A]
val surface: Surface = wvlet.airframe.surface.of[A]
val map = ListMap.newBuilder[String, A]
for ((k, v) <- yaml) yield {
map += k.toString -> bindMap[A](surface, v.asInstanceOf[ju.Map[AnyRef, AnyRef]].asScala.toMap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import java.util.Properties

import wvlet.airframe.config.Config.REPORT_UNUSED_PROPERTIES
import wvlet.log.Logger
import wvlet.surface

import scala.reflect.ClassTag

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package wvlet.airframe.config
import wvlet.airframe.AirframeSpec
import wvlet.airframe._
import wvlet.surface.tag._
import wvlet.airframe.surface.tag._

trait AppTag

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.util.Properties
import wvlet.airframe.AirframeSpec
import wvlet.airframe.config.PropertiesConfig.{ConfigKey, Prefix}
import wvlet.log.io.IOUtil
import wvlet.surface.tag._
import wvlet.airframe.surface.tag._

trait AppScope
trait SessionScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.twitter.util.Future
import wvlet.airframe.codec.{JSONCodec, MessageCodec}
import wvlet.airframe.http.{ControllerProvider, ResponseHandler, Router}
import wvlet.log.LogSupport
import wvlet.surface.Surface
import wvlet.airframe.surface.Surface

/**
* A filter for dispatching http requests to the predefined routes with Finagle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package wvlet.airframe.http

import wvlet.log.LogSupport
import wvlet.surface.Surface
import wvlet.airframe.surface.Surface

import scala.util.{Failure, Success, Try}
import wvlet.airframe._
Expand Down
8 changes: 4 additions & 4 deletions airframe-http/src/main/scala/wvlet/airframe/http/Router.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ package wvlet.airframe.http
import wvlet.airframe.codec.PrimitiveCodec.StringCodec
import wvlet.airframe.codec.{JSONCodec, MessageCodec, ParamListCodec}
import wvlet.log.LogSupport
import wvlet.surface
import wvlet.surface.{Surface, Zero}
import wvlet.surface.reflect._
import wvlet.airframe.surface
import wvlet.airframe.surface.{Surface, Zero}
import wvlet.airframe.surface.reflect._

import scala.reflect.runtime.{universe => ru}

Expand All @@ -42,7 +42,7 @@ class Router(val routes: Seq[Route]) {
*/
def add[Controller: ru.TypeTag]: Router = {
// Import ReflectSurface to find method annotations (Endpoint)
import wvlet.surface.reflect._
import wvlet.airframe.surface.reflect._

// Check prefix
val serviceSurface = surface.of[Controller]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
package wvlet.airframe.http

import wvlet.airframe.AirframeSpec
import wvlet.surface
import wvlet.surface.Surface
import wvlet.airframe.surface
import wvlet.airframe.surface.Surface

/**
*
Expand Down
6 changes: 3 additions & 3 deletions airframe-jmx/src/main/scala/wvlet/airframe/jmx/JMXMBean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import java.lang.reflect.Method
import javax.management._

import wvlet.log.LogSupport
import wvlet.surface.reflect._
import wvlet.surface.{MethodSurface, Parameter, ParameterBase, Surface}
import wvlet.airframe.surface.reflect._
import wvlet.airframe.surface.{MethodSurface, Parameter, ParameterBase, Surface}

import scala.reflect.runtime.{universe => ru}

Expand Down Expand Up @@ -147,7 +147,7 @@ object JMXMBean extends LogSupport {
}

private def isNestedMBean(p: ParameterBase): Boolean = {
import wvlet.surface.reflect._
import wvlet.airframe.surface.reflect._

val jmxParams = p.surface.params.find(x => x.findAnnotationOf[JMX].isDefined)
if (jmxParams.isDefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package wvlet.airframe.jmx

import wvlet.surface.{ParameterBase, Surface}
import wvlet.airframe.surface.{ParameterBase, Surface}

sealed trait MBeanParameter {
def name: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private[wvlet] object AirframeMacros {

val hasAbstractMethods = t.members.exists(x => x.isMethod && x.isAbstract && !x.isAbstractOverride)

val isTaggedType = t.typeSymbol.fullName.startsWith("wvlet.surface.tag.")
val isTaggedType = t.typeSymbol.fullName.startsWith("wvlet.airframe.surface.tag.")

val shouldInstantiateTrait = if (!a.isStatic) {
// = Non static type
Expand Down Expand Up @@ -135,7 +135,7 @@ private[wvlet] object AirframeMacros {
}

def surfaceOf(t: c.Type): c.Tree = {
q"wvlet.surface.of[$t]"
q"wvlet.airframe.surface.of[$t]"
}

def provider1Binding[D1: c.WeakTypeTag](factory: c.Tree, singleton: Boolean, eager: Boolean): c.Tree = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package wvlet.airframe.opts

import wvlet.surface.reflect.SurfaceFactory
import wvlet.airframe.surface.reflect.SurfaceFactory

import scala.reflect.runtime.{universe => ru}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ package wvlet.airframe.opts
import java.lang.reflect.InvocationTargetException

import wvlet.log.LogSupport
import wvlet.surface.reflect.{CName, MethodCallBuilder, SurfaceFactory}
import wvlet.surface.{MethodSurface, Surface, Zero}
import wvlet.airframe.surface.reflect.{CName, MethodCallBuilder, SurfaceFactory}
import wvlet.airframe.surface.{MethodSurface, Surface, Zero}

import scala.reflect.runtime.{universe => ru}

Expand Down Expand Up @@ -181,7 +181,7 @@ class Launcher(surface: Surface) extends LogSupport {
}

private lazy val commandList: Seq[Command] = {
import wvlet.surface.reflect._
import wvlet.airframe.surface.reflect._
trace(s"command class:${surface.name}")
val methods = SurfaceFactory.methodsOf(surface)
val lst = for (m <- methods; c <- m.findAnnotationOf[command]) yield new CommandDef(m, c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ package wvlet.airframe.opts
//--------------------------------------

import wvlet.log.{LogSupport, Logger}
import wvlet.surface._
import wvlet.surface.reflect.{GenericBuilder, ObjectBuilder, Path, SurfaceFactory}
import wvlet.airframe.surface._
import wvlet.airframe.surface.reflect.{GenericBuilder, ObjectBuilder, Path, SurfaceFactory}

import scala.collection.mutable.ArrayBuffer
import scala.reflect.ClassTag
Expand Down Expand Up @@ -93,7 +93,7 @@ sealed trait CLOptionItem {

abstract class CLOptionItemBase(val param: Parameter) extends CLOptionItem {
override def takesMultipleArguments: Boolean = {
import wvlet.surface.reflect.ReflectTypeUtil._
import wvlet.airframe.surface.reflect.ReflectTypeUtil._
val t: Class[_] = param.surface.rawType
isArray(t) || isSeq(t)
}
Expand Down Expand Up @@ -197,7 +197,7 @@ trait OptionSchema extends LogSupport {
}

object ClassOptionSchema extends LogSupport {
import wvlet.surface.reflect._
import wvlet.airframe.surface.reflect._

/**
* Create an option schema from a given class definition
Expand Down Expand Up @@ -278,7 +278,7 @@ class ClassOptionSchema(val surface: Surface, val options: Seq[CLOption], val ar
* @param method
*/
class MethodOptionSchema(method: MethodSurface) extends OptionSchema {
import wvlet.surface.reflect._
import wvlet.airframe.surface.reflect._
val options =
for (p <- method.args; opt <- p.findAnnotationOf[option]) yield new CLOption(Path(p.name), opt, p)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package wvlet.airframe.opts

import wvlet.log.LogSupport
import wvlet.surface.reflect.Path
import wvlet.airframe.surface.reflect.Path

/**
* Holder of structured data consisting of named values. ValueHolder is immutable, so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package wvlet.airframe.stream.spi
import java.util.Locale

import wvlet.airframe.stream.spi.SQLModel.Expression
import wvlet.surface.Surface
import wvlet.airframe.surface.Surface

object SQLSchema {
sealed trait Schema
Expand Down
Loading

0 comments on commit 5ca3143

Please sign in to comment.