mgonto/factory_pal

Option values

Closed this issue · 4 comments

I have the following type:

case class Product(product_name: String, 
  manufacturer: String, 
  family: Option[String], 
  model: String)

And my register definition is the following:

def register() = {
      FactoryPal.register[Product]() { p =>
        p.product_name.mapsTo("Sony DSC-W310") and
        p.manufacturer.mapsTo("Sony") and
        p.family.mapsTo(Some("DSC-W310")) and
        p.model.mapsTo("Cyber-shot")
      }
    }

There seems to be an issue with the Option type (Or maybe I am doing it wrong?)

class Option takes type parameters
[error]         p.family.mapsTo(Some("DSC-W310")) and
[error]         ^
[error] one error found

Where am I to place that type parameter?

Hi,

Thanks for the report.

Try SomeString

If it doesnt work tell me and I'll fix this as soon as I get back to
Argentina

Sent from my iPad. Excuse brevity and typos.

On 04/01/2013, at 10:01, Tim Steinbach notifications@github.com wrote:

I have the following type:

case class Product(product_name: String,
manufacturer: String,
family: Option[String],
model: String)

And my register definition is the following:

def register() = {
FactoryPal.registerProduct { p =>
p.product_name.mapsTo("Sony DSC-W310") and
p.manufacturer.mapsTo("Sony") and
p.family.mapsTo(Some("DSC-W310")) and
p.model.mapsTo("Cyber-shot")
}
}

There seems to be an issue with the Option type (Or maybe I am doing it
wrong?)

class Option takes type parameters
[error] p.family.mapsTo(Some("DSC-W310")) and
[error] ^
[error] one error found

Where am I to place that type parameter?


Reply to this email directly or view it on
GitHubhttps://github.com//issues/1.

No, that's not it. It does the same thing.

I'll take a look then. Thanks!!!

Sent from my iPad. Excuse brevity and typos.

On 04/01/2013, at 15:30, Tim Steinbach notifications@github.com wrote:

No, that's not it. It does the same thing.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/1#issuecomment-11898474.

I think, I just fixed this :D
You may want to review the pull request I am about to send, because I had never worked with Reflection before.
I will just write a few test cases and then send it in.