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

若者とJava

 若者とJava

LT at 渋谷Java 01

@hotchemi

June 29, 2013
Tweet

More Decks by @hotchemi

Other Decks in Programming

Transcript

  1. null҆શͷϞνϕʔγϣϯ // ஫ҙɿ͜ͷίʔυ͸ίϯύΠϧ͞Εͳ͍ fun main(args : Array<String>) { val foo

    : String = null // ඇnullܕ val bar : String? = null // nullڐ༰ܕ val baz : String? = "Hello, Kotlin!" baz.length // nullͷՄೳੑ͕͋ΔͷͰίϯύΠϧΤϥʔ if(baz != null) { baz.length // nullνΣοΫ͞Ε͍ͯΔͷͰOK } }
  2. public static void success(String oauth_verifier) { YouRoom youRoom = Cache.get("youRoom",

    YouRoom.class); AccessToken token = youRoom.getAccessToken(oauth_verifier); User user = youRoom.verifyCredentials(); int youRoomId = user.getId(); Member member = Member.findOrCreate(youRoomId); member.youRoomId = youRoomId; member.token = token.getAccessToken(); member.tokenSecret = token.getAcceessTokenSecret(); member.mail = user.getEmail(); member.save(); flash.success("ϩάΠϯ͠·ͨ͠Ň"); session.put("sessionKey", member.id); setting(); } ௚ײతͳORMͱController
  3. @Override public void init(Router router) { // ///////////////////////////////////////////////////////////////////// // some

    default functions // ///////////////////////////////////////////////////////////////////// // simply render a page: router.GET().route("/").with(ApplicationController.class, "index"); router.GET().route("/examples").with(ApplicationController.class, "examples"); router.GET().route("/assets/.*").with(AssetsController.class, "serve"); } } public Result flashSuccess(Context context) { Result result = Results.html(); // sets a 18n flash message and adds a timestamp to make sure formatting works Optional<String> flashMessage = messages.get("flashSuccess", context, Optional.of(result), "PLACEHOLDER"); if (flashMessage.isPresent()) { context.getFlashCookie().success(flashMessage.get()); } return result; } src/main/java/conf/Routes.java src/main/java/controllers/ApplicationController.java
  4. public class Weather { @Inject @Path("index.gtmpl") Template index; @View public

    void index() { index.render(); } } <form action="@{add()}" method="post" style="float:left"> <fieldset> <div class="controls"> <div class="input-append"> <input class="span2" type="text" size="16" name="location" value=""/> <button type="submit" class="btn">Add</button> </div> </div> </fieldset> </form> Controller View