Kotlin

使用例
@GetMapping(“/login”)
fun handle(@CookieValue(“JSESSIONID”) cookie: String) {

Kotlin

構文
@PostMapping(“xxx”, consumes = )
サンプルコード

@PostMapping("/users", consumes = ) fun addUser(@R ...

Kotlin

構文
@GetMapping(“/{パラメータ名}”)
fun 関数名(@PathVariable 関数: 型)
サンプルコード

@RestController@RequestMa ...

Kotlin

構文
@Controller
class クラス名
サンプルコード

import org.springframework.ui.set@Controllerclass UserController { @ ...

Kotlin

構文

class クラス名:インターフェース名{ override fun 関数名(){ some codes }}

1.インターフェースの定義

interface TestInterface { fun abc() ...

Kotlin

構文

class 子クラス:親クラス{ constructor(xxx):super(xx) { some code }}

1.親クラスの定義

open class Person(name:String){ const ...

Kotlin

構文
open class 親クラス名(p: Int)
class 子クラス名(p: Int) : 親クラス名(p)

使用例

//Base class 親クラスopen class Person(va ...

Kotlin

構文
val 変数名 = if(条件式) {
}

使用例1

val kk = if (bb < 32) { "this is aa if"} else { "this is bb else"} ...

Kotlin

構文
enum class 列挙名(xxxx){
変数名(値)
}
使用例1

enum class Color(val rgb: Int) { RED(0xFF0000), GREEN(0x00F ...

Kotlin

書式
リスト名「インデックス」
リスト名.get(インデックス)
使用例

fun main() { val lstA= listOf("AA01","BB02","CC03","DD04") val mL ...

Kotlin

書式
Regex(“^文字列.”)
サンプルコード

fun main() {//先頭の文字列を指定 val ptn = Regex("^ST.") val cftA = "ST2" val ...

Kotlin

書式
public static List<String> readAllLines(Path path, Charset cs) throws IOException
使用例

import java ...

Kotlin

書式
Regex(“文字\\.”)
使用例

fun main() { val ptn = Regex("test\\.") println("result: "+"test.".match ...

Kotlin

書式
public static Path write(Path path, Iterable<? extends CharSequence> lines,
Charset cs, OpenOption&# ...

Kotlin

書式
contains(文字列)

使用例

fun main() { val cftA = listOf("A001","B002","C003") val cftB = mutableListOf("A001 ...

Kotlin

書式
list変数名.size
mutableList変数名.size
使用例

fun main() { val lstA = listOf("AA01","BB02","CC03","DD04") va ...

Kotlin

書式
append(文字列)

使用例

fun main() { val strA = "test" val strB = " message " val sb = StringBuilder()//文字列追加 ...

Kotlin

サンプルコード

fun main(args: Array<String>) { for (i in 1..10) { if (i==3) continue println(i) if (i>5) break } ...