本文整理汇总了Scala中com.fasterxml.jackson.annotation.JsonTypeInfo类的典型用法代码示例。如果您正苦于以下问题:Scala JsonTypeInfo类的具体用法?Scala JsonTypeInfo怎么用?Scala JsonTypeInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JsonTypeInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: Of
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.entities
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.flipkart.connekt.commons.dao.JSONField
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[HTTPEventSink], name = "HTTP"),
new Type(value = classOf[KafkaEventSink], name = "KAFKA"),
new Type(value = classOf[SpecterEventSink], name = "SPECTER"),
new Type(value = classOf[RMQEventSink], name = "RMQ")
))
abstract class EventSink extends JSONField
case class HTTPEventSink(method:String, url: String) extends EventSink
case class KafkaEventSink(topic: String, broker: String) extends EventSink
case class SpecterEventSink() extends EventSink
case class RMQEventSink(queue: String, host: String, username: String, password: String) extends EventSink
示例2: Of
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.iomodels
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "message_type"
)
@JsonSubTypes(Array(
new Type(value = classOf[XmppAck], name = "ack"),
new Type(value = classOf[XmppNack], name = "nack"),
new Type(value = classOf[XmppReceipt], name = "receipt"),
new Type(value = classOf[XmppControl], name = "control")
))
abstract class XmppResponse {
def responseType(): String
}
示例3: Of
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.iomodels
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[PNRequestData], name = "PN"),
new Type(value = classOf[GCardRequestData], name = "GCard"),
new Type(value = classOf[EmailRequestData], name="EMAIL"),
new Type(value = classOf[SmsRequestData], name="SMS")
))
abstract class ChannelRequestData
示例4: GenericResponse
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.iomodels
import com.fasterxml.jackson.annotation.JsonInclude.Include
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonInclude, JsonSubTypes, JsonTypeInfo}
case class GenericResponse(status: Int, request: AnyRef, response: ResponseBody)
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[Response], name = "RESPONSE"),
new Type(value = classOf[SendResponse], name = "SEND_RESPONSE")
))
abstract class ResponseBody
case class Response(@JsonInclude(Include.NON_NULL) message: String, data: Any) extends ResponseBody
case class SendResponse(@JsonInclude(Include.NON_NULL) message: String, success: Map[String, Set[String]], failure: List[String]) extends ResponseBody
示例5: Of
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.iomodels
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.flipkart.connekt.commons.entities.DeviceCallbackEvent
import com.flipkart.connekt.commons.entities.bigfoot.PublishSupport
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[PNCallbackEvent], name = "PN"),
new Type(value = classOf[EmailCallbackEvent], name = "EMAIL"),
new Type(value = classOf[DeviceCallbackEvent], name = "DEVICE"),
new Type(value = classOf[SmsCallbackEvent], name = "SMS")
))
abstract class CallbackEvent extends PublishSupport {
def contactId: String
def messageId: String
def eventId: String
def eventType:String
def contextId : String
def appName : String
def clientId : String
}
示例6: Of
//设置package包名称以及导入依赖的类
package com.flipkart.connekt.commons.iomodels
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[PNRequestInfo], name = "PN"),
new Type(value = classOf[EmailRequestInfo], name = "EMAIL"),
new Type(value = classOf[SmsRequestInfo], name = "SMS"),
new Type(value = classOf[CardsRequestInfo], name = "CARD")
))
abstract class ChannelRequestInfo
示例7: Of
//设置package包名称以及导入依赖的类
package com.bwsw.sj.engine.core.entities
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "streamType")
@JsonSubTypes(Array(
new Type(value = classOf[TStreamEnvelope], name = "stream.t-stream"),
new Type(value = classOf[KafkaEnvelope], name = "stream.kafka"),
new Type(value = classOf[EsEnvelope], name = "elasticsearch-output"),
new Type(value = classOf[JdbcEnvelope], name = "jdbc-output")
))
class Envelope() {
protected var streamType: String = null
var stream: String = null
var partition: Int = 0
var tags: Array[String] = Array()
}
示例8: Of
//设置package包名称以及导入依赖的类
package com.bwsw.sj.crud.rest
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo, JsonProperty}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "stream-type")
@JsonSubTypes(Array(new Type(value = classOf[CassStream], name = "cassandra"),
new Type(value = classOf[TestStream], name = "test")
))
class SjStreamTest {
var name: String = null
var description: String = "No description"
@JsonProperty("stream-type") var streamType: String = null
}
class CassStream extends SjStreamTest {
var keyspace: String = null
}
class TestStream extends SjStreamTest {
var ttt: Int = 0
}
示例9: Of
//设置package包名称以及导入依赖的类
package model
import java.util.Date
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = Constants.Type,
visible = true
)
@JsonSubTypes(Array(
new Type(value = classOf[EmailNotification], name = Constants.Email),
new Type(value = classOf[PagerdutyNotification], name = Constants.Pagerduty)
))
sealed trait Notification {
def `type`: String
}
case class EmailNotification(name: String, email: String, notifyAction: String) extends Notification {
override val `type` = Constants.Email
}
case class PagerdutyNotification(serviceKey: String, apiUrl: String, numConsecutiveFailures: Int) extends Notification {
override val `type` = Constants.Pagerduty
}
case class Team(name: String, email: String, notifyAction: String)
case class ProcessDefinition(name: String,
description: Option[String],
schedule: Option[ProcessSchedule],
overlapAction: ProcessOverlapAction,
notifications: Seq[Notification],
createdAt: Date,
isPaused: Boolean)
object Constants {
private[model] final val Type = "type"
private[model] final val Email = "email"
private[model] final val Pagerduty = "pagerduty"
}
示例10: Of
//设置package包名称以及导入依赖的类
package io.buoyant.namerd.storage.kubernetes
import com.fasterxml.jackson.annotation.{JsonProperty, JsonSubTypes, JsonTypeInfo}
import io.buoyant.k8s.{Status, Watch}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes(Array(
new JsonSubTypes.Type(value = classOf[DtabAdded], name = "ADDED"),
new JsonSubTypes.Type(value = classOf[DtabModified], name = "MODIFIED"),
new JsonSubTypes.Type(value = classOf[DtabDeleted], name = "DELETED"),
new JsonSubTypes.Type(value = classOf[DtabError], name = "ERROR")
))
sealed trait DtabWatch extends Watch[Dtab]
// NOTE: These are not (as would be usual practice) inside a DtabWatch companion object,
// because doing so leads to intermittent compilation failures from
// https://issues.scala-lang.org/browse/SI-7551.
case class DtabAdded(`object`: Dtab) extends DtabWatch with Watch.Added[Dtab]
case class DtabModified(`object`: Dtab) extends DtabWatch with Watch.Modified[Dtab]
case class DtabDeleted(`object`: Dtab) extends DtabWatch with Watch.Deleted[Dtab]
case class DtabError(
@JsonProperty(value = "object") status: Status
) extends DtabWatch with Watch.Error[Dtab]
示例11: Of
//设置package包名称以及导入依赖的类
package io.buoyant.linkerd.protocol.http
import com.fasterxml.jackson.annotation.{JsonIgnore, JsonSubTypes, JsonTypeInfo}
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finagle.{ServiceFactory, Stack, Stackable}
import io.buoyant.router.RouterLabel
import io.buoyant.router.http.AddForwardedHeader
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "kind"
)
@JsonSubTypes(Array(
new JsonSubTypes.Type(value = classOf[IpLabelerConfig], name = "ip"),
new JsonSubTypes.Type(value = classOf[IpPortLabelerConfig], name = "ip:port"),
new JsonSubTypes.Type(value = classOf[ConnectionRandomLabelerConfig], name = "connectionRandom"),
new JsonSubTypes.Type(value = classOf[RequestRandomLabelerConfig], name = "requestRandom"),
new JsonSubTypes.Type(value = classOf[RouterLabelerConfig], name = "router"),
new JsonSubTypes.Type(value = classOf[StaticLabelerConfig], name = "static")
))
trait LabelerConfig {
@JsonIgnore
def mk(params: Stack.Params): AddForwardedHeader.Labeler
}
val module: Stackable[ServiceFactory[Request, Response]] =
new Stack.Module[ServiceFactory[Request, Response]] {
val role = Stack.Role("ConfigureAddForwardedHeader")
val description = AddForwardedHeader.module.description
val parameters = Seq(implicitly[Stack.Param[Param]])
private type Stk = Stack[ServiceFactory[Request, Response]]
def make(params: Stack.Params, stk: Stk) = params[Param] match {
case Param(None) => stk
case Param(Some(config)) =>
// Wrap the underlying stack, applying the ForwardedHeaderConfig
val mkNext: (Stack.Params, Stk) => Stk =
(prms, next) => Stack.Leaf(this, next.make(prms ++: config))
Stack.Node(this, mkNext, stk)
}
}
}
示例12: Of
//设置package包名称以及导入依赖的类
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.fasterxml.jackson.databind.annotation.{JsonDeserialize, JsonSerialize}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(Array(
new Type(value = classOf[Sigmoid], name = "sigmoid")
))
trait ActivationFunctionTrait{
def activate(z: Double) : Double
}
class Sigmoid extends ActivationFunctionTrait{
override def activate(z:Double) : Double = {
1 / (1 + Math.exp(z * (-1)))
}
}
class Step extends ActivationFunctionTrait{
override def activate(z:Double) : Double = {
if(z<0) 0
else 1
}
}
示例13: Of
//设置package包名称以及导入依赖的类
package com.sk.app.proxmock.application.domain.conditions
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.sk.app.proxmock.application.configuration.ConfigurationContext
import org.springframework.messaging.Message
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes(Array(
new Type(value = classOf[HeaderMatches], name="headerMatches"),
new Type(value = classOf[UriMatches], name="uriMatches"),
new Type(value = classOf[BodyMatches], name="bodyMatches"),
new Type(value = classOf[RandomCondition], name="random"),
new Type(value = classOf[AlwaysTrueCondition], name="alwaysTrue"),
new Type(value = classOf[AlwaysFalseCondition], name="alwaysFalse"),
new Type(value = classOf[GroovyExpression], name="groovyExpression"),
new Type(value = classOf[GroovyExpressionFile], name="groovyExpressionFile")
))
abstract class Condition {
def test(message: Message[Object], context: ConfigurationContext): Boolean
}
示例14: Of
//设置package包名称以及导入依赖的类
package com.sk.app.proxmock.application.domain.providers.url
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.sk.app.proxmock.application.configuration.ConfigurationContext
import org.springframework.messaging.Message
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes(Array(
new Type(value = classOf[StaticUrlProvider], name="static"),
new Type(value = classOf[StaticFromFileUrlProvider], name="staticFromFile"),
new Type(value = classOf[GroovyExpressionUrlProvider], name="groovyExpression"),
new Type(value = classOf[GroovyExpressionFromFileUrlProvider], name="groovyExpressionFromFile")
))
abstract class UrlProvider {
def get(context: ConfigurationContext, message: Message[Object]): String
}
示例15: Of
//设置package包名称以及导入依赖的类
package com.sk.app.proxmock.application.domain.providers.statuscode
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import com.sk.app.proxmock.application.configuration.ConfigurationContext
import org.springframework.messaging.Message
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes(Array(
new Type(value = classOf[SuccessStatusCodeProvider], name="success"),
new Type(value = classOf[StaticStatusCodeProvider], name="static"),
new Type(value = classOf[StaticFromFileStatusCodeProvider], name="staticFromFile"),
new Type(value = classOf[GroovyExpressionStatusCodeProvider], name="groovyExpression"),
new Type(value = classOf[GroovyExpressionFromFileStatusCodeProvider], name="groovyExpressionFromFile"),
new Type(value = classOf[ConditionalStatusCodeProvider], name="conditional")
))
abstract class StatusCodeProvider {
def get(context: ConfigurationContext, message: Message[Object]): Int
}