• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala field类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Scala中scala.annotation.meta.field的典型用法代码示例。如果您正苦于以下问题:Scala field类的具体用法?Scala field怎么用?Scala field使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了field类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。

示例1: TestMapData

//设置package包名称以及导入依赖的类
package com.newegg.eims.DataPorter.Base

import com.newegg.eims.DataPorter.Base.Converts._
import org.scalatest.{FlatSpec, Matchers}

import scala.annotation.meta.field


case class TestMapData(@([email protected])(CInt) a: Int, @([email protected])(CString) b: String)

case class TestMapData2(@([email protected])(CString) c: String)

class MapDataSetSpec extends FlatSpec with Matchers {

  private val data = Array(1, 2, 3, 4, 5).toIterable.transform(
    new DataColumn(0, "a", CInt, i => Some(i * 5)),
    new DataColumn(1, "b", CString, i => Some(i.toString))
  )

  "MapDataSet" should "equal map col" in {
    var index = 1
    val iter = data.mapTo( newOrOverrideCols = Array(
      new DataColumn[IDataRow](0, "b", CString, i => Some(i.getVal("b").getOrElse("") + "cc"))
    )).toRowIterator
    iter.getSchema.getColumns.length shouldBe 2
    iter.foreach(r => {
      r.getVal(0) shouldBe Some(index * 5)
      r.getVal(1) shouldBe Some(index.toString + "cc")
      r.getVal("a") shouldBe Some(index * 5)
      r.getVal("b") shouldBe Some(index.toString + "cc")
      index += 1
    })
    index shouldBe 6
    iter.hasNext shouldBe false
    iter.next() shouldBe null
  }

  it should "StructDataSet equal map col" in {
    var index = 1
    val iter = data.as[TestMapData].mapTo(removeCols = Set("a","B"), newOrOverrideCols = Array(
      new DataColumn[TestMapData](0, "c", CString, i => Some(i.b + "cc"))
    )).as[TestMapData2].iterator
    iter.foreach(r => {
      r.c shouldBe index.toString + "cc"
      index += 1
    })
    index shouldBe 6
    iter.hasNext shouldBe false
    assertThrows[Exception](iter.next())
  }
} 
开发者ID:CodeBabyBear,项目名称:DataPorter,代码行数:52,代码来源:MapDataSetSpec.scala


示例2: uuid

//设置package包名称以及导入依赖的类
package de.mukis.js

import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|

@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID

@js.native
trait UUID extends js.Object {

  def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v1(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v4(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def parse(
    id: String,
    buffer: js.UndefOr[js.Array[Double]] = js.undefined,
    offset: js.UndefOr[Double] = js.undefined
  ): js.Array[Double] = js.native

  def unparse(
    buffer: js.Array[Double],
    offset: js.UndefOr[Double] = js.undefined
  ): String = js.native

}

case class UUIDOptions(
  @(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
  @(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
  @(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
  @(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
) 
开发者ID:muuki88,项目名称:scala-target-examples,代码行数:51,代码来源:uuid.scala


示例3: TestD1

//设置package包名称以及导入依赖的类
package com.newegg.eims.DataPorter.Csv

import java.io.File

import com.newegg.eims.DataPorter.Base.Converts._
import com.newegg.eims.DataPorter.Base._
import com.newegg.eims.DataPorter.Csv.Converts._
import org.apache.commons.csv.CSVFormat
import org.scalatest.{FlatSpec, Matchers}

import scala.annotation.meta.field
import scala.io.Source



case class TestD1(@([email protected])(CInt) a: Int, @([email protected])(CString) b: String)

class CsvDataSetWriterSpec extends FlatSpec with Matchers {
  val data = Array(1, 2).toIterable.transform(
    new DataColumn(0, "a", CInt, i => Some(i * 5)),
    new DataColumn(1, "b", CString, i => Some(i.toString))
  )
  val currentDir = new File(".").getCanonicalPath + File.separator + "target" + File.separator

  "CscDataSet" should "saveCsv with no format and no append" in {
    val f = data.saveCsv(currentDir + "test.csv")
    f.exists() shouldBe true
    val source = Source.fromFile(f)
    val info = try source.mkString finally source.close()
    info shouldBe "5;1\r\n10;2\r\n"
    f.delete() shouldBe true
  }

  it should "saveCsv with custom format and append" in {
    val format = CSVFormat.newFormat(',').withTrim(true).withRecordSeparator("\r\n")
    data.saveCsv(currentDir + "test1.csv", isAppend = false, format).exists() shouldBe true
    val f = data.as[TestD1]().saveCsv(currentDir + "test1.csv", isAppend = true, format)
    f.exists() shouldBe true
    val source = Source.fromFile(f)
    val info = try source.mkString finally source.close()
    info shouldBe "5,1\r\n10,2\r\n5,1\r\n10,2\r\n"
  }
} 
开发者ID:CodeBabyBear,项目名称:DataPorter,代码行数:44,代码来源:CsvDataSetWriterSpec.scala


示例4: Person

//设置package包名称以及导入依赖的类
package sample

import java.util.OptionalInt

import scala.annotation.meta.field
import org.seasar.doma._

@Entity(immutable = true)
case class Person(
  @([email protected])
  @([email protected])(strategy = GenerationType.IDENTITY)
  id: OptionalInt = OptionalInt.empty,
  @([email protected])(updatable = false)
  name: Name,
  age: OptionalInt,
  address: Address,
  departmentId: OptionalInt,
  @([email protected])
  version: OptionalInt = OptionalInt.of(-1)
) 
开发者ID:bakenezumi,项目名称:scala-doma-sample,代码行数:21,代码来源:Person.scala


示例5: uuid

//设置package包名称以及导入依赖的类
package net.gutefrage

import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|

@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID

@js.native
trait UUID extends js.Object {

  def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v1(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v4(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def parse(
    id: String,
    buffer: js.UndefOr[js.Array[Double]] = js.undefined,
    offset: js.UndefOr[Double] = js.undefined
  ): js.Array[Double] = js.native

  def unparse(
    buffer: js.Array[Double],
    offset: js.UndefOr[Double] = js.undefined
  ): String = js.native

}

case class UUIDOptions(
  @(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
  @(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
  @(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
  @(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
) 
开发者ID:muuki88,项目名称:node-scalajs,代码行数:51,代码来源:uuid.scala


示例6: uuid

//设置package包名称以及导入依赖的类
package uuid

import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|

@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends UUID

@js.native
trait UUID extends js.Object {

  def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v1(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v4(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def parse(
    id: String,
    buffer: js.UndefOr[js.Array[Double]] = js.undefined,
    offset: js.UndefOr[Double] = js.undefined
  ): js.Array[Double] = js.native

  def unparse(
    buffer: js.Array[Double],
    offset: js.UndefOr[Double] = js.undefined
  ): String = js.native

}

case class UUIDOptions(
  @(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
  @(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
  @(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
  @(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
) 
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:51,代码来源:uuid.scala


示例7: uuid

//设置package包名称以及导入依赖的类
package uuid

import scala.annotation.meta.field
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.annotation.{JSExport, JSImport}
import scala.scalajs.js.|

@JSImport("node-uuid/uuid", Namespace)
@js.native
object uuid extends js.Object {

  def v1(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v1(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def v4(options: js.UndefOr[UUIDOptions] = js.undefined): String = js.native

  def v4(
    options: UUIDOptions,
    buffer: js.Array[Double],
    offset: js.UndefOr[Double]
  ): js.Array[Double] = js.native

  def parse(
    id: String,
    buffer: js.UndefOr[js.Array[Double]] = js.undefined,
    offset: js.UndefOr[Double] = js.undefined
  ): js.Array[Double] = js.native

  def unparse(
    buffer: js.Array[Double],
    offset: js.UndefOr[Double] = js.undefined
  ): String = js.native

}

case class UUIDOptions(
  @(JSExport @field) node: js.UndefOr[js.Array[js.Any]] = js.undefined,
  @(JSExport @field) clockseq: js.UndefOr[Double] = js.undefined,
  @(JSExport @field) msecs: js.UndefOr[Double | js.Date] = js.undefined,
  @(JSExport @field) nsecs: js.UndefOr[Double] = js.undefined
) 
开发者ID:scalacenter,项目名称:scalajs-bundler,代码行数:48,代码来源:uuid.scala


示例8: getVersion

//设置package包名称以及导入依赖的类
package com.softwaremill.bootzooka.version

import javax.ws.rs.Path

import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import com.softwaremill.bootzooka.common.api.RoutesSupport
import com.softwaremill.bootzooka.version.BuildInfo._
import io.circe.generic.auto._
import io.swagger.annotations.{ApiResponse, _}

import scala.annotation.meta.field

trait VersionRoutes extends RoutesSupport with VersionRoutesAnnotations {

  implicit val versionJsonCbs = CanBeSerialized[VersionJson]

  val versionRoutes = pathPrefix("version") {
    pathEndOrSingleSlash {
      getVersion
    }
  }

  def getVersion: Route =
    complete {
      VersionJson(buildSha.substring(0, 6), buildDate)
    }
}

@Api(
  value = "Version",
  produces = "application/json", consumes = "application/json"
)
@Path("api/version")
trait VersionRoutesAnnotations {

  @ApiOperation(httpMethod = "GET", response = classOf[VersionJson], value = "Returns an object which describes running version")
  @ApiResponses(Array(
    new ApiResponse(code = 500, message = "Internal Server Error"),
    new ApiResponse(code = 200, message = "OK", response = classOf[VersionJson])
  ))
  @Path("/")
  def getVersion: Route
}

@ApiModel(description = "Short description of the version of an object")
case class VersionJson(
  @(ApiModelProperty @field)(value = "Build number") build: String,
  @(ApiModelProperty @field)(value = "The timestamp of the build") date: String
) 
开发者ID:Bii03,项目名称:students-clustering,代码行数:51,代码来源:VersionRoutes.scala


示例9: JacksonAnnotations

//设置package包名称以及导入依赖的类
package webby.commons.io.jackson

import com.fasterxml.jackson.annotation.JsonAutoDetect

import scala.annotation.meta.{field, getter, param}


object JacksonAnnotations {
  // @formatter:off
  type JsonAutoDetect = com.fasterxml.jackson.annotation.JsonAutoDetect @param @field @getter
  type JsonDeserialize = com.fasterxml.jackson.databind.annotation.JsonDeserialize @param @field @getter
  type JsonFormat = com.fasterxml.jackson.annotation.JsonFormat @param @field @getter
  type JsonIgnore = com.fasterxml.jackson.annotation.JsonIgnore @param @field @getter
  type JsonIgnoreProperties = com.fasterxml.jackson.annotation.JsonIgnoreProperties @param @field @getter
  type JsonInclude = com.fasterxml.jackson.annotation.JsonInclude @param @field @getter
  type JsonProperty = com.fasterxml.jackson.annotation.JsonProperty @param @field @getter
  type JsonRawValue = com.fasterxml.jackson.annotation.JsonRawValue @param @field @getter
  type JsonRootName = com.fasterxml.jackson.annotation.JsonRootName @param @field @getter
  type JsonSerialize = com.fasterxml.jackson.databind.annotation.JsonSerialize @param @field @getter
  type JsonTypeInfo = com.fasterxml.jackson.annotation.JsonTypeInfo @param @field @getter
  type JsonUnwrapped = com.fasterxml.jackson.annotation.JsonUnwrapped @param @field @getter
  // @formatter:on

  @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE,
    isGetterVisibility = JsonAutoDetect.Visibility.NONE,
    setterVisibility = JsonAutoDetect.Visibility.NONE,
    creatorVisibility = JsonAutoDetect.Visibility.NONE,
    fieldVisibility = JsonAutoDetect.Visibility.NONE)
  trait JsonDisableAutodetect
} 
开发者ID:citrum,项目名称:webby,代码行数:31,代码来源:JacksonAnnotations.scala


示例10: NewCover

//设置package包名称以及导入依赖的类
package no.ndla.listingapi.model.api

import no.ndla.listingapi.model.domain.ThemeName
import no.ndla.listingapi.model.meta.Theme
import org.scalatra.swagger.annotations.ApiModel
import org.scalatra.swagger.runtime.annotations.ApiModelProperty

import scala.annotation.meta.field

@ApiModel(description = "Meta information for a new cover")
case class NewCover(@([email protected])(description = "The language in this request") language: String,
  @([email protected])(description = "A cover photo for the cover") coverPhotoUrl: String,
  @([email protected])(description = "The title for this cover") title: String,
  @([email protected])(description = "The description for this cover") description: String,
  @([email protected])(description = "The link to the article") articleApiId: Long,
  @([email protected])(description = "The id of the old article") oldNodeId: Option[Long],
  @([email protected])(description = "The labels associated with this cover") labels: Seq[Label],
  @([email protected])(description = "The meta theme associated with this cover") theme: String
) 
开发者ID:NDLANO,项目名称:listing-api,代码行数:20,代码来源:NewCover.scala


示例11: UpdateCover

//设置package包名称以及导入依赖的类
package no.ndla.listingapi.model.api

import org.scalatra.swagger.annotations.ApiModel
import org.scalatra.swagger.runtime.annotations.ApiModelProperty

import scala.annotation.meta.field

@ApiModel(description = "Meta information for a updated cover")
case class UpdateCover(@([email protected])(description = "The language in this request") language: String,
  @([email protected])(description = "The revision number of this cover") revision: Int,
  @([email protected])(description = "A cover photo for the cover") coverPhotoUrl: Option[String],
  @([email protected])(description = "The link to the article") articleApiId: Option[Long],
  @([email protected])(description = "The title for this cover") title: String,
  @([email protected])(description = "The description for this cover") description: String,
  @([email protected])(description = "The labels associated with this cover") labels: Seq[Label],
  @([email protected])(description = "The meta theme associated with this cover") theme: String
) 
开发者ID:NDLANO,项目名称:listing-api,代码行数:18,代码来源:UpdateCover.scala



注:本文中的scala.annotation.meta.field类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala FromConfig类代码示例发布时间:2022-05-23
下一篇:
Scala Assert类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap