Skip to content

Instantly share code, notes, and snippets.

@adarro
adarro / DSLWicket.scala
Last active January 12, 2022 12:05 — forked from brunoborges/DSLWicket.scala
Scala DSL for Wicket
package code.webapp
import scala.collection.JavaConversions.seqAsJavaList
import org.apache.wicket.behavior.AttributeAppender
import org.apache.wicket.extensions.markup.html.form.DateTextField
import org.apache.wicket.extensions.validation.validator.RfcCompliantEmailAddressValidator
import org.apache.wicket.markup.html.WebMarkupContainer
import org.apache.wicket.markup.html.basic.{Label, MultiLineLabel}
import org.apache.wicket.markup.html.form._
import org.apache.wicket.markup.html.link.{BookmarkablePageLink, ExternalLink, Link}
@adarro
adarro / builder-phantom-types.scala
Created July 3, 2019 10:32 — forked from MaximilianoFelice/builder-phantom-types.scala
A Builder example in Scala using Phantom Types
case class Food(ingredients: Seq[String])
class Chef[Pizza <: Chef.Pizza] protected (ingredients: Seq[String]) {
import Chef.Pizza._
def addCheese(cheeseType: String): Chef[Pizza with Cheese] = Chef(ingredients :+ cheeseType)
def addTopping(toppingType: String): Chef[Pizza with Topping] = Chef(ingredients :+ toppingType)
def addDough: Chef[Pizza with Dough] = Chef(ingredients :+ "dough")