Hi Chris,
Do you mean that any constructor parameters can be replaced by an object
that provides those parameters?
for an instance, if address, port, ssl are saved in a config file, I have to
pass a ConfigFile object as the parameter of the HttpTransport constructor.
Am I right?
thank you
Chris Lewis-5 wrote:
>
> I'm not sure I understand the constructor parameters. Do you mean they
> come from some other object (HttpRequest)? If so, why not just take
> HttpRequest as a constructor argument? If you do that then you can auto
> bind this service and IoC will know how to create it. If you insist on
> the parameters currently listed, then you'll need to have a service
> builder method, and inject HttpRequest as an argument into that method.
>
> lyifan wrote:
>> I want to implement a service:
>>
>> public interface Transport {
>> public void send();
>> }
>>
>> public class HttpTransport implement Transport {
>> private String _address;
>> private int _port;
>> private boolean _ssl;
>> public HttpTransport (String address, int port, boolean ssl) {
>> _address = address;
>> _port = port;
>> _ssl = ssl;
>> }
>>
>> public void send) {
>> // ......
>> }
>> }
>>
>> The parameter of the constructor is from http request. How can I build
>> this
>> service? I know I can use setters, but I just wanna know how to build a
>> service using constructor.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/T5.0.6-about-Tapestry-ioc-tf4820490.html#a13792550
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]