Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataRecord instantiation #30

Closed
dbolene opened this issue Feb 8, 2011 · 2 comments
Closed

DataRecord instantiation #30

dbolene opened this issue Feb 8, 2011 · 2 comments
Labels

Comments

@dbolene
Copy link

dbolene commented Feb 8, 2011

given:
case class EventListType(eventlisttypeoption: scalaxb.DataRecord[Any]*)

I can

for(e <- eventDoc.EPCISBody.EventList.get.eventlisttypeoption) {
  e.value match {
    case e: ObjectEventType =>
      EventDebugServices.displayObjectEvent(e)
    case e: AggregationEventType =>
      EventDebugServices.displayAggregationEvent(e)
    case e: QuantityEventType =>
      EventDebugServices.displayQuantityEvent(e)
    case e: TransactionEventType =>
      EventDebugServices.displayTransactionEvent(e)
    case u =>
      System.out.println("Unknown Event: " + u)
  }
}

Each e is of course a DataRecord.

How do I instantiate DataRecords to build back up the object graph from scratch?

If I say "DataRecord(event)" where event is say... a ObjectEventType the compiler complains with "could not find implicit value for evidence parameter of type scalaxb.CanWriteXML[com.ghx.tnt.core.event.ObjectEventType]"

thanks,

david...

@eed3si9n
Copy link
Owner

eed3si9n commented Feb 8, 2011

The implicits are defined in DefaultXMLProtocol, so try

import com.ghx.tnt.core.event._
import DefaultXMLProtocol._
DataRecord(r.namespace, r.key, event)

@eed3si9n
Copy link
Owner

eed3si9n commented Feb 9, 2011

Fixed.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants