Created
August 8, 2019 06:13
-
-
Save tkawachi/1a0daaf0a859d06eea7fcd825ced61c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util | |
import io.radanalytics.operator.common.{AbstractOperator, EntityInfo, Operator} | |
import scala.beans.BeanProperty | |
import scala.jdk.CollectionConverters._ | |
class Book(@BeanProperty var title: String, | |
@BeanProperty var authors: util.List[String]) | |
extends EntityInfo { | |
def this() = this(null, null) | |
override def toString: String = | |
s"Book(namespace=$namespace, name=$name, title=$title, authors=(${Option(authors).map(_.asScala.mkString(", ")).orNull}))" | |
} | |
@Operator(forKind = classOf[Book], prefix = "myoperator.example.com") | |
class BookOperator extends AbstractOperator[Book] { | |
override def onAdd(entity: Book): Unit = println(s"Added a book $entity") | |
override def onDelete(entity: Book): Unit = println(s"Deleted a book $entity") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.13.0" | |
libraryDependencies ++= Seq("io.radanalytics" % "abstract-operator" % "0.6.6") | |
mainClass in Compile := Some("io.radanalytics.operator.Entrypoint") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: myoperator.example.com/v1 | |
kind: Book | |
metadata: | |
name: moby-dick | |
spec: | |
title: Moby Dick | |
authors: | |
- Herman Melville | |
- Takashi Kawachi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment