本文整理汇总了Scala中java.lang.Boolean类的典型用法代码示例。如果您正苦于以下问题:Scala Boolean类的具体用法?Scala Boolean怎么用?Scala Boolean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Boolean类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ArticleController
//设置package包名称以及导入依赖的类
package org.invisibletech.tinyblog.controller
import java.lang.Boolean
import java.lang.Long
import javax.validation.Valid
import org.invisibletech.tinyblog.model.Article
import org.invisibletech.tinyblog.service.ArticleRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.validation.BindingResult
import org.springframework.web.bind.annotation.{ RestController, PathVariable, RequestMapping, RequestMethod, RequestBody }
@RestController
@RequestMapping(Array("/articles"))
class ArticleController @Autowired() (private val articleRepository: ArticleRepository) {
@RequestMapping(method = Array(RequestMethod.GET))
def list() = {
articleRepository.findAll()
}
@RequestMapping(method = Array(RequestMethod.POST))
def addArticle(@RequestBody() article: Article): Article = {
article.setId(null)
articleRepository.saveAndFlush(article)
}
@RequestMapping(value = Array("/{id}"), method = Array(RequestMethod.PUT))
def updateArticle(@RequestBody() article: Article, @PathVariable() id: Long): Article = {
// Trust but verify - use Option and orThrow
Option(articleRepository.findOne(id)) match {
case Some(found) => {
article.id = found.id
articleRepository.saveAndFlush(article)
}
case None => throw new ArticleNotFoundException(Map("id" -> id), "Article not found.")
}
}
@RequestMapping(value = Array("/{id}"), method = Array(RequestMethod.DELETE))
def deleteArticle(@PathVariable() id: Long) = {
articleRepository.delete(id)
// To make sure a 200 with NO CONTENT is not returned we do this.
new ResponseEntity[Boolean](Boolean.TRUE, HttpStatus.NO_CONTENT)
}
}
示例2: ProfileProxy
//设置package包名称以及导入依赖的类
package aug.profile
import java.io.File
import java.lang.Boolean
import java.util
import aug.script.framework.{ProfileInterface, TextWindowInterface, WindowReference}
class ProfileProxy(profile: Profile) extends ProfileInterface {
import profile.offer
override def send(cmds: String): Unit = offer(SendData(cmds))
override def sendSilently(cmds: String): Unit = offer(SendData(cmds, true))
override def setWindowGraph(windowReference: WindowReference): Boolean = profile.setWindowGraph(windowReference)
override def getWindowNames: util.List[String] = profile.getWindowNames
override def createTextWindow(name: String): TextWindowInterface = profile.createTextWindow(name)
override def getTextWindow(name: String): TextWindowInterface = profile.getTextWindow(name)
override def getClientDir: File = ConfigManager.getClientDir(profile.name)
override def logText(log: Boolean): Unit = offer(ProfileLog(log, false))
override def logColor(log: Boolean): Unit = offer(ProfileLog(log, true))
override def connect(): Unit = profile.connect()
override def disconnect(): Unit = profile.disconnect()
override def reconnect(): Unit = profile.reconnect()
override def closeProfile(): Unit = profile.close()
override def printException(t: Throwable): Unit = profile.handleClientException(t)
override def clientStop(): Unit = profile.clientStop()
override def clientRestart(): Unit = profile.clientRestart()
}