-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an XML/Json marshaller based on Xstream
But: - T5 does not support Obj[FirstType[SecondType]] - discovered https://lampsvn.epfl.ch/trac/scala/ticket/1802
- Loading branch information
fanf
committed
Mar 24, 2009
1 parent
76fcff3
commit 5595f0f
Showing
12 changed files
with
453 additions
and
101 deletions.
There are no files selected for viewing
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
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
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
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
10 changes: 0 additions & 10 deletions
10
src/main/scala/org/example/blog/services/ArticleIdGenerator.scala
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.example.blog.services | ||
|
||
/* | ||
* Marshaller are unit conversion betwin a | ||
* specific string format and a object hierarchie. | ||
* | ||
*/ | ||
|
||
//an (real) marshaller, from object to string | ||
trait WoMarshaller { | ||
def to(o:Any) : String | ||
} | ||
|
||
//an unmarshaller | ||
trait RoMarshaller { | ||
def from(s:String) : Any | ||
} | ||
|
||
trait Marshaller extends WoMarshaller with RoMarshaller | ||
|
||
|
||
/* | ||
* The client wand a more straighfoward call where | ||
* she gives a wanted type and the object, and | ||
* return the string in the wanted type | ||
* (or throw an error) | ||
* | ||
* That's a web client function, it's as little typed as possible ;) | ||
*/ | ||
trait ClientMarshaller { | ||
def to(format:String, obj:Any) : String | ||
def from(format:String, s:String) : Any | ||
} | ||
|
||
/* | ||
* An abstract class that represent | ||
* different type of Marshaller and | ||
* which is destinated to | ||
* be extended by case class, like : | ||
* final case class Xml extends MarshallerType | ||
*/ | ||
abstract class MarshallerType | ||
|
||
/* | ||
* A service that retrieve a MarshallerType | ||
* given a String. | ||
* It will be use in Chain of command like | ||
* pattern | ||
*/ | ||
|
||
trait MarshallerAnalyzer { | ||
//return null if can not handle the format, the good marshaller implementation else | ||
def get(format:String) : MarshallerType | ||
} | ||
|
||
|
Oops, something went wrong.