-
Notifications
You must be signed in to change notification settings - Fork 546
Scala Integration
Joe Betz edited this page Apr 9, 2014
·
8 revisions
Rest.li is fully integrated with the SBT build system through an SBT plugin. See Rest.li SBT Plugin.
Rest.li resource classes may be written in Scala. For example:
**
* A sample scala resource.
*/
@RestLiCollection(name="sampleScala", namespace = "com.example.restli")
class SampleScalaResource extends CollectionResourceTemplate[java.lang.Long, Sample] with PlayRequest {
/**
* A sample scala get.
*/
override def get(key: java.lang.Long): Sample = {
val message = "hello world"
new Sample()
.setMessage(s"You got this from a Scala Resource: ${message}!")
.setId(key)
}
}
Scaladoc is supported via a plugin. This is currently ONLY available for scala 2.10. To enable the plugin in gradle, modify your build.gradle files, adding a dependency on restli-tools-scala and depending on it the module that contains your rest.li resource scala classes.
project.ext.externalDependency = [
// ...
'scalaLibrary_2_10': 'org.scala-lang:scala-library:2.10.3'
],
spec = [
"product" : [
"pegasus" : [
// ...
"restliToolsScala_2_10" : "com.linkedin.pegasus:restli-tools-scala_2.10:"+pegasusVersion
]
]
]
apply plugin: 'pegasus'
apply plugin: 'scala'
ext.apiProject = ...
dependencies {
// ...
compile externalDependency.scalaLibrary_2_10
compile product.pegasus.restliToolsScala_2_10
}
Quick Access:
- Tutorials
- Dynamic Discovery
- Request Response API
-
Rest.li User Guide
- Rest.li Server
- Resources
- Resource Types
- Resource Methods
- Rest.li Client
- Projections
- Filters
- Wire Protocol
- Data Schemas
- Data
- Unstructured Data
- Tools
- FAQ