On Mon, 20 Aug 2012 12:36:34 -0300, George Christman <gchrist...@cardaddy.com> wrote:

public static SomeService someServiceBuilder(Service1 service1, Service2
service2) {
  return new SomeService(service1, service2);
}

This can be replaced by binder.bind().

and returns a new Class(service1, service2). I wasn't aware you could pass in non service objs into the method.

Which method? The builder method parameters can only handle services and a couple other objects (distributed configuration and other objects that aren't services but have injection provided for them. Inside the method, you can do anything you want.

In my case I have an entity called
ImportTask.class. I'm populating the ImportTask from a hibernate criteria
query.

@Inject
private AutoMateParser autoMateParser;

ImportTask importTasks = (ImportTask) session.get(ImportTask.class,
DatabaseConstant.AUTOMATE_PARSER);

for(ImporTask importTask : importTasks) {
   //non service
   AutoMateParser autoMateParser = new AutoMateParser(importTask);

   //With Service
   autoMateParser.set(importTasks);
}

I tried something like this below,

public static AutoMateParser autoMateParserBuilder(ImportTask importTask) {
    return new AutoMateParser(importTask);
}

but couldn't figure out how to actually pass my import obj into the builder method so it ends up .

Declare ImportTask as a service and it'll work.

The only way I know of getting that non service obj
into my Service is with a set. Could you explain an alternate way to
passing in that obj so it ends up in the service constructor?

public static SomeService someServiceBuilder(Service1 service1, Service2 service2) {
    SomeService service = new SomeService(service1, service2);
    SomethingElse else = ...; // do anything you want here
    service.setSomethingElse(else);
    return service;
}

--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to