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
case class Person(personsequence1: jp.sf.amateras.scala.util.xsd.PersonSequence1*) | |
case class PersonSequence1(lang: jp.sf.amateras.scala.util.xsd.Lang) | |
case class Lang(value: String) |
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
// SqlManager#iterate()内でBreakableIterationCallbackだったらisBreak()をチェックするようなイメージ。 | |
public abstract class BreakableIterationCallback<A, B> implements IterationCallback<A, B> { | |
private boolean break = false; | |
public void setBreak(){ | |
this.break = break; | |
} | |
public boolean isBreak(){ |
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
// これはOK | |
val result = SQL("SELECT * FROM EMP E INNER JOIN DEPT D ON D.DEPT_ID = E.DEPT_ID ORDER BY EMP_ID") | |
.as(Emp ~< Dept *) | |
// これもOK | |
val result = SQL("SELECT * FROM EMP E " + | |
"INNER JOIN DEPT D ON D.DEPT_ID = E.DEPT_ID " + | |
"ORDER BY EMP_ID").as(Emp ~< Dept *) | |
// これはNG |
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
case class Book( | |
@(PrimaryKey @field)(generationType = IDENTITY) bookId: Option[Long], | |
bookName: String, | |
author: String, | |
price: Option[Int]) { | |
// default constructor | |
def this() = this(None, null, null, None) | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project default="count" basedir="." > | |
<!-- 独自タスクの定義 相対パスからの target フォルダ配下にJARを置いてください。--> | |
<taskdef name="stepcounter" classname="jp.sf.amateras.stepcounter.ant.StepCounterTask" | |
classpath="target/stepcounter-3.0.1-SNAPSHOT-jar-with-dependencies.jar" /> | |
<taskdef name="diffcounter" classname="jp.sf.amateras.stepcounter.ant.DiffCounterTask" | |
classpath="target/stepcounter-3.0.1-SNAPSHOT-jar-with-dependencies.jar" /> | |
<target name="count"> |
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 org.picocontainer.DefaultPicoContainer | |
/** | |
* Simple wrapper of PicoContainer for Scala. | |
* | |
* {{{ | |
* val pico = new Pico() | |
* .add[Apple] | |
* .add[Juicer] | |
* .add[Peeler] |
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 language.experimental.macros | |
import scala.reflect.makro.Context | |
object MacroSample { | |
def compiledTime(): String = macro compiledTime_impl | |
def compiledTime_impl(c: Context)(): c.Expr[String] = { | |
import c.mirror._ | |
import c.reify |
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
def NotVar(expr: Any): Any = macro NotVarImpl | |
def NotVarImpl(c: Context)(expr: c.Expr[Any]): c.Expr[Any] = { | |
import c.mirror._ | |
import reflect.api.Modifier.mutable | |
Expr((new Transformer{ | |
override def transform(tree:Tree):Tree = tree match{ | |
case ValDef(m,_,_,_) if m.hasModifier(mutable) => sys.error("can't use var !!!") | |
case _ => super.transform(tree) |
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 org.scalatest._ | |
import org.scalatest.events._ | |
/** | |
* An example which runs ScalaTest by program. | |
*/ | |
object RunScalaTest extends App { | |
// MySuite is a testsuite | |
new MySuite().run(None, new Reporter { |
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
case class Product(id: String, manu: String, name: String) | |
val client = new SolrClient("http://localhost:8983/solr") | |
val result = client.query("name: %name%") | |
.fields("id", "manu", "name") | |
.sortBy("id", Order.asc) | |
.getResultAs[Product](Map("name" -> "ThinkPad X201s")) | |
result.documents.foreach { product => |