Hi,

That annotation is used to configure the json path when extracting
values. By default the extraction code assumes that case class
parameter names match with json field names. For instance these match:

case class Foo(bar: String, baz: Int)
{ "bar": "qwerty", "baz": 10 }

But sometimes json field names can contain characters which are not
allowed in Scala identifiers. For example:
{ "foo-bar": "qwerty", "baz": 10 }

Now, to able to extract this we have to somehow tell the extractor the
exact path explicitly. Currently @path annotation is used for that:
case class Foo(@path("foo-bar") bar: String, baz: Int)

I don't see how a trait can accomplish this, maybe I'm missing
something?

The reason why it is in Java is that Scala annotations are not
accessible at  runtime.

Cheers Joni

On Sep 13, 11:03 pm, Timothy Perrett <timo...@getintheloop.eu> wrote:
> Just had a browse over the latest commit and found the following in
> path.java:
>
> @Retention(RetentionPolicy.RUNTIME)
> @Target(ElementType.TYPE)
> public @interface path {
>     public String value();
>
> }
>
> Any reason were not using a trait etc to complete the same
> functionality?
>
> Cheers, Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to