20090522 Scalaユーザー会#1

1,306 views
1,261 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,306
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

20090522 Scalaユーザー会#1

  1. 1. 2009 5 22
  2. 2. • • • • 2009 5 22
  3. 3. 2009 5 22
  4. 4. • • • • 2009 5 22
  5. 5. • • • • • 2009 5 22
  6. 6. 2009 5 22
  7. 7. 2009 5 22
  8. 8. 2009 5 22
  9. 9. 2009 5 22
  10. 10. 2009 5 22
  11. 11. 2009 5 22
  12. 12. 2009 5 22
  13. 13. • • • • 2009 5 22
  14. 14. 2009 5 22
  15. 15. • • • 2009 5 22
  16. 16. • • • • 2009 5 22
  17. 17. 2009 5 22
  18. 18. • 2009 5 22
  19. 19. • • 2009 5 22
  20. 20. • • • 2009 5 22
  21. 21. • • • • 2009 5 22
  22. 22. 2009 5 22
  23. 23. 2009 5 22
  24. 24. 2009 5 22
  25. 25. 2009 5 22
  26. 26. • • • • 2009 5 22
  27. 27. 2009 5 22
  28. 28. • <p><lift:helloWorld.howdy
/></p> class
HelloWorld
{ 

def
howdy
=
<span>Welcome
to
helloworld
at
 {new
_root_.java.util.Date}</span> } 2009 5 22
  29. 29. • 2009 5 22
  30. 30. • 2009 5 22
  31. 31. • 2009 5 22
  32. 32. • <p> 

<lift:helloWorld.howdy
/> </p> 2009 5 22
  33. 33. • class
HelloWorld
{ 

def
howdy
=
 






<span> 







Welcome
to
helloworld
at
 








{new
_root_.java.util.Date} 





</span> } 2009 5 22
  34. 34. • <lift:SampleSnipet.add
form=quot;POSTquot;> 



<entry:description
/>
 



<entry:amount
/>
<br
/> 



<entry:submit
/> </lift:
SampleSnipet.add
> 2009 5 22
  35. 35. • class
SampleSnipet
 


def
add
(xhtml
:
NodeSeq)
:
NodeSeq
=
{ 







var
desc
=
quot;quot; 







var
amount
=
quot;0quot; 







def
processEntryAdd
()
{
...
} 







bind(quot;entryquot;,
xhtml, 











quot;descriptionquot;
->
SHtml.text(desc,
desc
=
_), 











quot;amountquot;
->
SHtml.text(amount,
amount
=
_), 











quot;submitquot;
->
SHtml.submit(Add,
 

















processEntryAdd)) 



} } 2009 5 22
  36. 36. 2009 5 22
  37. 37. • • • • • 2009 5 22
  38. 38. • ‣ ‣ ‣ • ‣ ‣ ‣ 2009 5 22
  39. 39. • class
Expense
extends
LongKeyedMapper[Expense]
with
IdPK
{ 


def
getSingleton
=
Expense 


object
dateOf
extends
MappedDateTime(this) 


object
description
extends
MappedString(this,100) 


object
amount
extends
MappedDecimal(this, 








MathContext.DECIMAL64,
2) 


object
account
extends
 





MappedLongForeignKey(this,
Account) } 2009 5 22
  40. 40. • object
Expense
extends
Expense
with
 LongKeyedMetaMapper[Expense]
{ override
def
fieldOrder
=
 




List(dateOf,
description,
amount) } 2009 5 22
  41. 41. • val
myEntries1
=
Expense.findAll

 val
myEntries2
=
Expense.findAll(By_>(Expense.amout,5)
)
 val
recentEntries
=
Expense.findAll( 

BySql(quot;dateOf
>
(CURRENT_DATE
-
interval
’30
days’)quot;, 

IHaveValidatedThisSQL(quot;dchenbeckerquot;,quot;2008-12-03quot;)) 2009 5 22
  42. 42. • var
myEntr=
Expense.create myEntry.dateOf(new
Date).description(quot;A
sample
entryquot;) myEntry.amount(BigDecimal(quot;127.20quot;)) myEntry.save myEntry.delete 2009 5 22
  43. 43. 2009 5 22
  44. 44. • • • • 2009 5 22
  45. 45. 2009 5 22
  46. 46. • • • • 2009 5 22
  47. 47. • • • 2009 5 22
  48. 48. 2009 5 22
  49. 49. 2009 5 22
  50. 50. 2009 5 22

×