Upgrade to Pro — share decks privately, control downloads, hide ads and more …

プロジェクトでKotlinを導入した話

DMM.com
July 07, 2017

 プロジェクトでKotlinを導入した話

社内Kotlin勉強会でのLT資料を公開します!
サーバーサイドの Java プロジェクトの一部に Kotlin を導入した話!

DMM.com

July 07, 2017
Tweet

More Decks by DMM.com

Other Decks in Technology

Transcript

  1. val text = """
    for (c in "foo")
    print(c)
    """

    View full-size slide

  2. public interface UserMapper {
    @Select("select id, name, birthdate from users where id = #
    User select(int id);
    }

    View full-size slide

  3. interface UserMapper {
    @Select("""
    select
    id,
    name,
    birthdate
    from
    users
    where
    id = #{id}
    """)
    fun select(id: Int): User
    }

    View full-size slide

  4. String jobj = "{" +
    "\"key1\": \"val1\"," +
    "\"key2\": [\"val2a\", \"val2b\"]" +
    "}";
    String jobj = "{\"key1\":\"val1\",\"key2\":[\"val2a\",\"val2b\"
    String jobj = new JSONObject()
    .put("key1", "val1")
    .put("key2", new JSONArray().put("val2a").put("val2b"
    .toString();

    View full-size slide

  5. val jobj = """
    {
    "key1": "val1",
    "key2": ["val2a", "val2b"]
    }
    """

    View full-size slide

  6. doReturn(false).when(domain).isSuccess();
    doReturn(false).`when`(domain).isSuccess

    View full-size slide