Created
August 24, 2011 02:45
-
-
Save jackywyz/1167184 to your computer and use it in GitHub Desktop.
userTimeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val statusListBuffer = new ListBuffer[Status] | |
def userTimeline(options : OptionalParam*) : List[Status] = | |
{ | |
val optionsStr = new StringBuffer("?") | |
for (n <- (responseXML \\ "status").elements) | |
statusListBuffer += (Status.fromXml(n)) | |
statusListBuffer.toList | |
} | |
} | |
abstract class Status | |
{ | |
val createdAt : String | |
val id : Long | |
val text : String | |
val source : String | |
val truncated : Boolean | |
val inReplyToStatusId : Option[Long] | |
val inReplyToUserId : Option[Long] | |
val inReplyToScreenName : Option[String] | |
val favorited : Boolean | |
val user : User | |
} | |
object Status | |
{ | |
def fromXml(node : Node) : Status = | |
{ | |
new Status { | |
val createdAt = (node \ "created_at").text | |
.... | |
} | |
} | |
} |
对不起,我犯了个错误。。。
val statusListBuffer = new ListBuffer[Status]
for (n <- (responseXML \\ "status").elements)
statusListBuffer += (Status.fromXml(n))
statusListBuffer.toList
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why StringBuffer can transform to List[status]?