本文整理汇总了Scala中scala.beans.BeanProperty类的典型用法代码示例。如果您正苦于以下问题:Scala BeanProperty类的具体用法?Scala BeanProperty怎么用?Scala BeanProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BeanProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ChartOptions
//设置package包名称以及导入依赖的类
package com.iservport.chart.google
import scala.beans.BeanProperty
case class ChartOptions
(
@BeanProperty title: String = "",
@BeanProperty height: String = "200",
@BeanProperty colors: Array[String] = Array(),
@BeanProperty legend: String = "right",
@BeanProperty pieHole: Double = 0.0,
@BeanProperty fontSize: Int = 11,
@BeanProperty chartArea: ChartArea = ChartArea(),
@BeanProperty is3D: Boolean = false,
animation: Option[Animation] = None
) {
def getAnimation = animation match {
case Some(a) => a
case None => Animation(0)
}
val getSliceVisibilityThreshold = 0
val getPieSliceTextStyle = ChartTextStyle()
}
示例2: SplunkHecJsonLayout
//设置package包名称以及导入依赖的类
package io.policarp.logback
import ch.qos.logback.classic.pattern._
import ch.qos.logback.classic.spi.ILoggingEvent
import ch.qos.logback.core.LayoutBase
import io.policarp.logback.json.{ BaseJson, FullEventJson }
import org.json4s.native.Serialization._
import scala.beans.BeanProperty
import scala.collection._
case class SplunkHecJsonLayout() extends SplunkHecJsonLayoutBase {
import SplunkHecJsonLayout._
@BeanProperty var maxStackTrace: Int = 500
private val customFields = new mutable.HashMap[String, String]()
def setCustom(customField: String): Unit = {
customField.split("=", 2) match {
case Array(key, value) => customFields += (key.trim -> value.trim)
case _ => // ignoring anything else
}
}
override def doLayout(event: ILoggingEvent) = {
implicit val format = org.json4s.DefaultFormats
val eventJson = FullEventJson(
event.getFormattedMessage,
event.getLevel.levelStr,
event.getThreadName,
event.getLoggerName,
classOfCallerConverter.convert(event).filterEmptyConversion,
methodOfCallerConverter.convert(event).filterEmptyConversion,
lineOfCallerConverter.convert(event).filterEmptyConversion,
fileOfCallerConverter.convert(event).filterEmptyConversion,
extendedThrowableProxyConverter.convert(event).filterEmptyConversion,
parseStackTrace(event, maxStackTrace),
if (customFields.isEmpty) None else Some(customFields)
)
val baseJson = BaseJson(
event.getTimeStamp,
eventJson,
if (host.isEmpty) None else Some(host),
if (source.isEmpty) None else Some(source),
if (sourcetype.isEmpty) None else Some(sourcetype),
if (index.isEmpty) None else Some(index)
)
write(baseJson)
}
}
示例3: User1
//设置package包名称以及导入依赖的类
package example
import scala.beans.BeanProperty
import com.googlecode.objectify.annotation.{ Entity, Id }
@Entity
case class User1( @BeanProperty @Id ident: String, name: String, phone: String)
@Entity
class User{
@BeanProperty @Id
var ident: String = _
@BeanProperty
var name: String = _
@BeanProperty
var phone: String = _
override def toString = s"($ident, $name, $phone)"
}
object User {
def apply(ident1: String, name1: String, phone1: String): User = {
val u = new User()
u.ident = ident1
u.name = name1
u.phone = phone1
u
}
}
示例4: AppProperties
//设置package包名称以及导入依赖的类
package k8sdnssky
import org.springframework.boot.context.properties.ConfigurationProperties
import scala.beans.BeanProperty
object AppProperties {
@ConfigurationProperties(prefix = "dns")
class DnsProperties {
@BeanProperty var whitelist: String = _
@BeanProperty var blacklist: String = _
@BeanProperty var controllerClass: String = _
def whitelistAsList: List[String] = {
if (whitelist == null) {
Nil
} else {
whitelist.split(",").map(_.trim).toList
}
}
def blacklistAsList: List[String] = {
if (blacklist == null) {
Nil
} else {
blacklist.split(",").map(_.trim).toList
}
}
}
@ConfigurationProperties(prefix = "kubernetes")
class KubernetesProperties {
@BeanProperty var externalMasterUrl: String = _
}
}
示例5: EtcdProperties
//设置package包名称以及导入依赖的类
package k8sdnssky
import org.springframework.boot.context.properties.ConfigurationProperties
import scala.beans.BeanProperty
@ConfigurationProperties(prefix = "etcd")
class EtcdProperties {
@BeanProperty var endpoints: String = _
@BeanProperty var username: String = _
@BeanProperty var password: String = _
@BeanProperty var certFile: String = _
@BeanProperty var keyFile: String = _
@BeanProperty var caFile: String = _
@BeanProperty var timeout: Int = 5
@BeanProperty var backoffMinDelay: Int = 20
@BeanProperty var backoffMaxDelay: Int = 5000
@BeanProperty var backoffMaxTries: Int = 3
}
示例6: AppProperties
//设置package包名称以及导入依赖的类
package k8sslbnginxing
import org.springframework.boot.context.properties.ConfigurationProperties
import scala.beans.BeanProperty
object AppProperties {
object IngressProperties {
def singlePorts(list: String): Set[Int] = {
if (list == null || list.isEmpty) {
Set.empty
} else {
list.split(",").filter(!_.contains("-")).map(_.trim().toInt).toSet
}
}
def portRanges(list: String): Set[(Int, Int)] = {
if (list == null || list.isEmpty) {
Set.empty
} else {
list.split(",").filter(_.contains("-")).map(s => {
val lo = s.trim().split("-")(0).trim().toInt
val hi = s.trim().split("-")(1).trim().toInt
if (hi <= lo) throw new IllegalArgumentException("not a valid port range: " + s)
(lo, hi)
}).toSet
}
}
}
@ConfigurationProperties(prefix = "ingress")
class IngressProperties {
@BeanProperty var tcpConfigMap: String = _
@BeanProperty var udpConfigMap: String = _
@BeanProperty var pillar: String = _
@BeanProperty var portBlacklist: String = "80,442,443,0-1024,10240-10260,18080,30000-32767"
@BeanProperty var portWhitelist: String = _
}
}
示例7: LendingEntityNotExists
//设置package包名称以及导入依赖的类
package info.armado.ausleihe.remote.results
import javax.xml.bind.annotation.XmlRootElement
import scala.beans.BeanProperty
object LendingEntityNotExists {
def apply(barcode: String): LendingEntityNotExists = {
val lendingEntityExists = new LendingEntityNotExists()
lendingEntityExists.barcode = barcode
lendingEntityExists
}
def unapply(lendingEntityExists: LendingEntityNotExists): Option[String] =
Some(lendingEntityExists.barcode)
}
@XmlRootElement
class LendingEntityNotExists extends AbstractResult {
@BeanProperty
var barcode: String = _
override def equals(other: Any): Boolean = {
val Barcode = barcode
other match {
case LendingEntityNotExists(Barcode) => true
case _ => false
}
}
override def hashCode: Int = {
val prime = 31
var result = 1
result = prime * result + (if (barcode == null) 0 else barcode.hashCode)
result
}
override def toString: String = s"LendingEntityNotExists($barcode)"
}
示例8: Candidate
//设置package包名称以及导入依赖的类
package org.pdfextractor.algorithm.candidate
import java.util.{Locale, Objects}
import org.pdfextractor.db.domain.dictionary.PaymentFieldType
import scala.beans.BeanProperty
case class Candidate(@BeanProperty // for dependent RESTful API in Java
value: Any,
x: Integer,
y: Integer,
bold: Boolean,
height: Integer,
pageNo: Integer,
locale: Locale,
paymentFieldType: PaymentFieldType,
properties: Map[CandidateMetadata, Any])
extends Comparable[Candidate] {
Objects.requireNonNull(value)
override def compareTo(other: Candidate): Int = compare(this, other)
override def equals(other: Any): Boolean = {
other match {
case that: Candidate => this.value == that.value
case _ => false
}
}
override def hashCode(): Int = value.hashCode()
}
示例9: Server
//设置package包名称以及导入依赖的类
package com.arangodb
import scala.beans.BeanProperty
import org.eclipse.jetty.server.Request
import org.eclipse.jetty.server.handler.AbstractHandler
import com.arangodb.Server.Movie
import com.arangodb.util.MapBuilder
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
object Server {
private val COLLECTION_NAME = "ring_movies"
class Handler(arangoDB: ArangoDB) extends AbstractHandler {
override def handle(target: String,
req: Request,
httpReq: HttpServletRequest,
httpRes: HttpServletResponse) = {
httpRes.setContentType("text/html")
httpRes.setStatus(HttpServletResponse.SC_OK)
httpRes.getWriter().println("<h1>all movies that have \"Lord.*Rings\" in their title</h1>")
val cursor = getMovies(arangoDB)
while (cursor.hasNext()) {
httpRes.getWriter().println(cursor.next().title + "<br />")
}
req.setHandled(true)
}
}
def main(args: Array[String]): Unit = {
val arangoDB = new ArangoDB.Builder().host("arangodb-proxy.marathon.mesos").user("root").build();
val server = new org.eclipse.jetty.server.Server(8080)
server.setHandler(new Handler(arangoDB))
server.start
}
def getMovies(arangoDB: ArangoDB): ArangoCursor[Movie] = {
arangoDB.db().query("for doc in @@col return doc", new MapBuilder().put("@col", COLLECTION_NAME).get(), null, classOf[Movie])
}
case class Movie(@BeanProperty title: String) {
def this() = this(title = null)
}
}
示例10: NodeTypeConfig
//设置package包名称以及导入依赖的类
package co.teapot.tempest.server
import scala.beans.BeanProperty
import java.util
import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer
class NodeTypeConfig {
@BeanProperty var csvFile: String = null
@BeanProperty var nodeAttributes: util.List[util.Map[String, String]] = null
def attributeTypePairs: Seq[(String, String)] = {
val result = new ArrayBuffer[(String, String)]()
for (nodeTypePairMap <- nodeAttributes.asScala) {
for (nodeTypePair <- nodeTypePairMap.asScala) {
result += nodeTypePair
}
}
result
}
def attributeSet: Set[String] = {
(attributeTypePairs map (_._1)).toSet
}
}
示例11: Document
//设置package包名称以及导入依赖的类
package org.openbrazil.gestao
import java.util.UUID
import javax.persistence._
import scala.beans.BeanProperty
@javax.persistence.Entity
@Table(name = "gstn_document"
, uniqueConstraints = Array(new UniqueConstraint(columnNames = Array("entityId", "docCode"))))
class Document
( @BeanProperty @Column(length = 32) var entityId: String) {
@BeanProperty @Column(length = 32) @Id var id: String = UUID.randomUUID().toString.replaceAll("-", "")
@BeanProperty @Column(length = 32) var docCode: String = ""
@BeanProperty @Column(length = 256) var docAbstract: String = ""
@BeanProperty @Lob var docContent: String = ""
@BeanProperty var docType: Int = 0
def this() = this("") // empty constructor
def merge(command: Document) = {
docCode = command.docCode
docAbstract = command.docAbstract
docContent = command.docContent
docType = command.docType
this
}
}
示例12: AwsLambdaSample
//设置package包名称以及导入依赖的类
package org.nomadblacky.aws.lambda.samples
import com.amazonaws.services.lambda.runtime.Context
import scala.beans.BeanProperty
import scala.io.Source
class AwsLambdaSample {
def hello(request: Request, context: Context): Responce = {
Responce(Source.fromURL(request.url).mkString)
}
}
case class Request(@BeanProperty var url: String) {
def this() = this(url = "")
}
case class Responce(@BeanProperty var body: String) {
def this() = this(body = "")
}
示例13: Word
//设置package包名称以及导入依赖的类
package pl.writeonly.babel.entities
import pl.writeonly.babel.entities.Value._
import pl.writeonly.babel.entities.Part._
import javax.jdo.annotations._
import scala.beans.BeanProperty
object Word extends Entity {
def parse(toParse: String) = {
val splinters = toParse.split("'")
val word = new Word(splinters)
}
}
@PersistenceCapable(detachable = "true")
@PrimaryKey(name = "id")
class Word(
@Persistent @BeanProperty var pre: String,
@Persistent @BeanProperty var core: String,
@Persistent @BeanProperty var suf: String,
@Persistent @BeanProperty var part: Part,
@Persistent @BeanProperty var lang: Lang)
extends Entity {
var parent: Word = _
var list: List[Word] = _
//def this(pre: String, core: String, suf: String, part: String, lang: String) = this(pre, core, suf, new Part(part), new Lang(lang))
def this() = this("", "", "", "", "")
def this(strings: Array[String]) = this(strings(0), strings(1), strings(2), strings(3), strings(4))
def this(string: String) = this(string split "'")
def this(core: String, part: Part, lang: Lang) = this ("", core, "", part, lang)
def toCompare = pre + core + suf + part
def compareTo(that: Word) = toCompare.compareTo(that.toCompare);
override def toString = pre + " " + core + " " + suf + " " + part + " " + lang;
}
示例14: Relation
//设置package包名称以及导入依赖的类
package pl.writeonly.babel.entities
import javax.jdo.annotations._
import scala.beans.BeanProperty
object Relation {
def parse(toParse: String) = {
val parsed = toParse split "-"
new Relation(parsed)
}
}
@PersistenceCapable(detachable="true")
@PrimaryKey(name = "id")
class Relation(@Persistent @BeanProperty val key: Word, @Persistent @BeanProperty val value: Word) extends Entity {
def this(strings: Array[String]) = this (new Word(strings(0)), new Word(strings(1)))
def this(string: String) = this (string split "-")
def this() = this(null, null)
//override def toString = "" + key + "-" + value
}
示例15: InfoJPA
//设置package包名称以及导入依赖的类
package com.github.swwjf.ws
import javax.persistence.{Column, UniqueConstraint, Table, Entity}
import com.github.swwjf.libs.jpa.{Auditable, Versionable, Identifiable}
import scala.beans.BeanProperty
@Entity
@Table(name = "Information", uniqueConstraints = Array(
new UniqueConstraint(columnNames = Array("Label"))
))
private[ws] class InfoJPA extends Identifiable with Versionable with Auditable {
@BeanProperty
@Column(name = "Label", nullable = false, unique = true)
var label: String = _
@BeanProperty
@Column(name = "Main_Details", nullable = false)
var mainDetails: String = _
@BeanProperty
@Column(name = "Comments")
var comments: String = _
}