Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-18 Thread Igor Vaynberg
salve is available in the maven repo. the link is on the front page of
the project. you shouldnt be compiling it yourself.

-igor

On Tue, Aug 18, 2009 at 6:30 AM, Haulyn R. Jason wrote:
> Hi, all:
> The process of compiling salve is passed, and I tried to setup it and
> testing. But, how can I get guice injector from wicket?
> I use the code below in my wicket Application's init function,
>
> DependencyLibrary.addLocator(new GuiceBeanLocator(injector));
>
> but how can I get the guice injector?
>
> thanks!
>
>
>
> On Tue, Aug 18, 2009 at 5:31 PM, Haulyn R. Jason wrote:
>
>> Hi, Igor, Thanks for your reply, I tried salve but when I compile it, there
>> are some testing failures. Can you help me to find a binary download link?
>> Or any other solutions are also great! I need to make salve run with wicket
>> and guice.
>> Thanks.
>>
>>
>> On Tue, Aug 18, 2009 at 1:34 AM, Igor Vaynberg 
>> wrote:
>>
>>> the easiest thing is to inject your component and pass the reference
>>> into your model.
>>>
>>> outside that there is salve.googlecode.com that lets you inject any
>>> object.
>>>
>>> InjectorHolder.getInjector() doesnt work with guice because it is
>>> possible to have more then one injector - one per module.
>>>
>>> -igor
>>>
>>> On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jason
>>> wrote:
>>> > Hi, all:
>>> > I have a class which is likes below:
>>> >
>>> >
>>> > public class DetachableMemberModel extends
>>> LoadableDetachableModel {
>>> >
>>> >    private final long id;
>>> >
>>> >    public DetachableMemberModel(Member m) {
>>> >        this(m.getId());
>>> >    }
>>> >
>>> >    public DetachableMemberModel(long id) {
>>> >        if (id == 0) {
>>> >            throw new IllegalArgumentException();
>>> >        }
>>> >        this.id = id;
>>> >    }
>>> >
>>> >   �...@override
>>> >    public int hashCode() {
>>> >        return Long.valueOf(id).hashCode();
>>> >    }
>>> >
>>> >   �...@override
>>> >    public boolean equals(final Object obj) {
>>> >        if (obj == this) {
>>> >            return true;
>>> >        } else if (obj == null) {
>>> >            return false;
>>> >        } else if (obj instanceof DetachableMemberModel) {
>>> >            DetachableMemberModel other = (DetachableMemberModel) obj;
>>> >            return other.id == id;
>>> >        }
>>> >        return false;
>>> >    }
>>> >
>>> >   �...@override
>>> >    protected Member load() {
>>> >        // I do not know how to inject this service to
>>> > Object DetachableMemberModel
>>> >        return memberService.query(id);
>>> >    }
>>> > }
>>> >
>>> > please see the last method of this class, I do not know how to inject
>>> > memberService to this class.
>>> > If I use @Inject private MemberService memberService, I have to inject
>>> this
>>> > class to the WebPage, but I can not bind DetachableMemberModel to any
>>> > interface.
>>> >
>>> > So, I do not know to to implement this, can anybody help me? Thanks very
>>> > much.
>>> >
>>> > --
>>> > --
>>> > Enjoy. Thanks!
>>> >
>>> > Haulyn Microproduction
>>> >
>>> > Mobile: +086-15864011231
>>> > email: saharab...@gmail.com,
>>> >         hmp.hau...@foxmail.com
>>> > website: http://haulynjason.net
>>> > gtalk: saharab...@gmail.com
>>> > yahoo: jia_hao...@yahoo.com
>>> > msn: saharab...@gmail.com
>>> > skype: saharabear
>>> > QQ: 378606292
>>> >
>>> > Haulyn Jason
>>> >
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>>
>> --
>> --
>> Enjoy. Thanks!
>>
>> Haulyn Microproduction
>>
>> Mobile: +086-15864011231
>> email: saharab...@gmail.com,
>>          hmp.hau...@foxmail.com
>> website: http://haulynjason.net
>> gtalk: saharab...@gmail.com
>> yahoo: jia_hao...@yahoo.com
>> msn: saharab...@gmail.com
>> skype: saharabear
>> QQ: 378606292
>>
>> Haulyn Jason
>>
>>
>>
>
>
> --
> --
> Enjoy. Thanks!
>
> Haulyn Microproduction
>
> Mobile: +086-15864011231
> email: saharab...@gmail.com,
>         hmp.hau...@foxmail.com
> website: http://haulynjason.net
> gtalk: saharab...@gmail.com
> yahoo: jia_hao...@yahoo.com
> msn: saharab...@gmail.com
> skype: saharabear
> QQ: 378606292
>
> Haulyn Jason
>

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



Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-18 Thread Igor Vaynberg
it depends on how you initialize guice. if you are using a servlet
context listener then that creates the injector and sticks it into
servlet context where you can get it.

if you are creating the injector yourself then you have a reference to it.

-igor

On Tue, Aug 18, 2009 at 7:12 AM, Haulyn R. Jason wrote:
> Hi, all:
> I try to use
>        Injector injector =
> getMetaData(GuiceInjectorHolder.INJECTOR_KEY).getInjector();
>        DependencyLibrary.addLocator(new GuiceBeanLocator(injector));
> in the init() of Application, and use @Dependence instead of @Inject, but I
> got NullPointException.
>
>
>
>
> On Tue, Aug 18, 2009 at 9:30 PM, Haulyn R. Jason wrote:
>
>> Hi, all:
>> The process of compiling salve is passed, and I tried to setup it and
>> testing. But, how can I get guice injector from wicket?
>> I use the code below in my wicket Application's init function,
>>
>> DependencyLibrary.addLocator(new GuiceBeanLocator(injector));
>>
>> but how can I get the guice injector?
>>
>> thanks!
>>
>>
>>
>> On Tue, Aug 18, 2009 at 5:31 PM, Haulyn R. Jason wrote:
>>
>>> Hi, Igor, Thanks for your reply, I tried salve but when I compile it,
>>> there are some testing failures. Can you help me to find a binary download
>>> link? Or any other solutions are also great! I need to make salve run with
>>> wicket and guice.
>>> Thanks.
>>>
>>>
>>> On Tue, Aug 18, 2009 at 1:34 AM, Igor Vaynberg 
>>> wrote:
>>>
 the easiest thing is to inject your component and pass the reference
 into your model.

 outside that there is salve.googlecode.com that lets you inject any
 object.

 InjectorHolder.getInjector() doesnt work with guice because it is
 possible to have more then one injector - one per module.

 -igor

 On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jason
 wrote:
 > Hi, all:
 > I have a class which is likes below:
 >
 >
 > public class DetachableMemberModel extends
 LoadableDetachableModel {
 >
 >    private final long id;
 >
 >    public DetachableMemberModel(Member m) {
 >        this(m.getId());
 >    }
 >
 >    public DetachableMemberModel(long id) {
 >        if (id == 0) {
 >            throw new IllegalArgumentException();
 >        }
 >        this.id = id;
 >    }
 >
 >   �...@override
 >    public int hashCode() {
 >        return Long.valueOf(id).hashCode();
 >    }
 >
 >   �...@override
 >    public boolean equals(final Object obj) {
 >        if (obj == this) {
 >            return true;
 >        } else if (obj == null) {
 >            return false;
 >        } else if (obj instanceof DetachableMemberModel) {
 >            DetachableMemberModel other = (DetachableMemberModel) obj;
 >            return other.id == id;
 >        }
 >        return false;
 >    }
 >
 >   �...@override
 >    protected Member load() {
 >        // I do not know how to inject this service to
 > Object DetachableMemberModel
 >        return memberService.query(id);
 >    }
 > }
 >
 > please see the last method of this class, I do not know how to inject
 > memberService to this class.
 > If I use @Inject private MemberService memberService, I have to inject
 this
 > class to the WebPage, but I can not bind DetachableMemberModel to any
 > interface.
 >
 > So, I do not know to to implement this, can anybody help me? Thanks
 very
 > much.
 >
 > --
 > --
 > Enjoy. Thanks!
 >
 > Haulyn Microproduction
 >
 > Mobile: +086-15864011231
 > email: saharab...@gmail.com,
 >         hmp.hau...@foxmail.com
 > website: http://haulynjason.net
 > gtalk: saharab...@gmail.com
 > yahoo: jia_hao...@yahoo.com
 > msn: saharab...@gmail.com
 > skype: saharabear
 > QQ: 378606292
 >
 > Haulyn Jason
 >

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


>>>
>>>
>>> --
>>> --
>>> Enjoy. Thanks!
>>>
>>> Haulyn Microproduction
>>>
>>> Mobile: +086-15864011231
>>> email: saharab...@gmail.com,
>>>          hmp.hau...@foxmail.com
>>> website: http://haulynjason.net
>>> gtalk: saharab...@gmail.com
>>> yahoo: jia_hao...@yahoo.com
>>> msn: saharab...@gmail.com
>>> skype: saharabear
>>> QQ: 378606292
>>>
>>> Haulyn Jason
>>>
>>>
>>>
>>
>>
>> --
>> --
>> Enjoy. Thanks!
>>
>> Haulyn Microproduction
>>
>> Mobile: +086-15864011231
>> email: saharab...@gmail.com,
>>          hmp.hau...@foxmail.com
>> website: http://haulynjason.net
>> gtalk: saharab...@gmail.com
>> yahoo: jia_hao...@yahoo.com
>> msn: saharab...@gmail.com
>> skype: saharabear
>> QQ: 378606292
>>
>> Haulyn Jason
>>
>>
>>
>
>
> --
> 

Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-18 Thread Haulyn R. Jason
Hi, all:
The process of compiling salve is passed, and I tried to setup it and
testing. But, how can I get guice injector from wicket?
I use the code below in my wicket Application's init function,

DependencyLibrary.addLocator(new GuiceBeanLocator(injector));

but how can I get the guice injector?

thanks!



On Tue, Aug 18, 2009 at 5:31 PM, Haulyn R. Jason wrote:

> Hi, Igor, Thanks for your reply, I tried salve but when I compile it, there
> are some testing failures. Can you help me to find a binary download link?
> Or any other solutions are also great! I need to make salve run with wicket
> and guice.
> Thanks.
>
>
> On Tue, Aug 18, 2009 at 1:34 AM, Igor Vaynberg wrote:
>
>> the easiest thing is to inject your component and pass the reference
>> into your model.
>>
>> outside that there is salve.googlecode.com that lets you inject any
>> object.
>>
>> InjectorHolder.getInjector() doesnt work with guice because it is
>> possible to have more then one injector - one per module.
>>
>> -igor
>>
>> On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jason
>> wrote:
>> > Hi, all:
>> > I have a class which is likes below:
>> >
>> >
>> > public class DetachableMemberModel extends
>> LoadableDetachableModel {
>> >
>> >private final long id;
>> >
>> >public DetachableMemberModel(Member m) {
>> >this(m.getId());
>> >}
>> >
>> >public DetachableMemberModel(long id) {
>> >if (id == 0) {
>> >throw new IllegalArgumentException();
>> >}
>> >this.id = id;
>> >}
>> >
>> >@Override
>> >public int hashCode() {
>> >return Long.valueOf(id).hashCode();
>> >}
>> >
>> >@Override
>> >public boolean equals(final Object obj) {
>> >if (obj == this) {
>> >return true;
>> >} else if (obj == null) {
>> >return false;
>> >} else if (obj instanceof DetachableMemberModel) {
>> >DetachableMemberModel other = (DetachableMemberModel) obj;
>> >return other.id == id;
>> >}
>> >return false;
>> >}
>> >
>> >@Override
>> >protected Member load() {
>> >// I do not know how to inject this service to
>> > Object DetachableMemberModel
>> >return memberService.query(id);
>> >}
>> > }
>> >
>> > please see the last method of this class, I do not know how to inject
>> > memberService to this class.
>> > If I use @Inject private MemberService memberService, I have to inject
>> this
>> > class to the WebPage, but I can not bind DetachableMemberModel to any
>> > interface.
>> >
>> > So, I do not know to to implement this, can anybody help me? Thanks very
>> > much.
>> >
>> > --
>> > --
>> > Enjoy. Thanks!
>> >
>> > Haulyn Microproduction
>> >
>> > Mobile: +086-15864011231
>> > email: saharab...@gmail.com,
>> > hmp.hau...@foxmail.com
>> > website: http://haulynjason.net
>> > gtalk: saharab...@gmail.com
>> > yahoo: jia_hao...@yahoo.com
>> > msn: saharab...@gmail.com
>> > skype: saharabear
>> > QQ: 378606292
>> >
>> > Haulyn Jason
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> --
> Enjoy. Thanks!
>
> Haulyn Microproduction
>
> Mobile: +086-15864011231
> email: saharab...@gmail.com,
>  hmp.hau...@foxmail.com
> website: http://haulynjason.net
> gtalk: saharab...@gmail.com
> yahoo: jia_hao...@yahoo.com
> msn: saharab...@gmail.com
> skype: saharabear
> QQ: 378606292
>
> Haulyn Jason
>
>
>


-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-18 Thread Haulyn R. Jason
Hi, Igor, Thanks for your reply, I tried salve but when I compile it, there
are some testing failures. Can you help me to find a binary download link?
Or any other solutions are also great! I need to make salve run with wicket
and guice.
Thanks.


On Tue, Aug 18, 2009 at 1:34 AM, Igor Vaynberg wrote:

> the easiest thing is to inject your component and pass the reference
> into your model.
>
> outside that there is salve.googlecode.com that lets you inject any
> object.
>
> InjectorHolder.getInjector() doesnt work with guice because it is
> possible to have more then one injector - one per module.
>
> -igor
>
> On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jason
> wrote:
> > Hi, all:
> > I have a class which is likes below:
> >
> >
> > public class DetachableMemberModel extends
> LoadableDetachableModel {
> >
> >private final long id;
> >
> >public DetachableMemberModel(Member m) {
> >this(m.getId());
> >}
> >
> >public DetachableMemberModel(long id) {
> >if (id == 0) {
> >throw new IllegalArgumentException();
> >}
> >this.id = id;
> >}
> >
> >@Override
> >public int hashCode() {
> >return Long.valueOf(id).hashCode();
> >}
> >
> >@Override
> >public boolean equals(final Object obj) {
> >if (obj == this) {
> >return true;
> >} else if (obj == null) {
> >return false;
> >} else if (obj instanceof DetachableMemberModel) {
> >DetachableMemberModel other = (DetachableMemberModel) obj;
> >return other.id == id;
> >}
> >return false;
> >}
> >
> >@Override
> >protected Member load() {
> >// I do not know how to inject this service to
> > Object DetachableMemberModel
> >return memberService.query(id);
> >}
> > }
> >
> > please see the last method of this class, I do not know how to inject
> > memberService to this class.
> > If I use @Inject private MemberService memberService, I have to inject
> this
> > class to the WebPage, but I can not bind DetachableMemberModel to any
> > interface.
> >
> > So, I do not know to to implement this, can anybody help me? Thanks very
> > much.
> >
> > --
> > --
> > Enjoy. Thanks!
> >
> > Haulyn Microproduction
> >
> > Mobile: +086-15864011231
> > email: saharab...@gmail.com,
> > hmp.hau...@foxmail.com
> > website: http://haulynjason.net
> > gtalk: saharab...@gmail.com
> > yahoo: jia_hao...@yahoo.com
> > msn: saharab...@gmail.com
> > skype: saharabear
> > QQ: 378606292
> >
> > Haulyn Jason
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Igor Vaynberg
the easiest thing is to inject your component and pass the reference
into your model.

outside that there is salve.googlecode.com that lets you inject any object.

InjectorHolder.getInjector() doesnt work with guice because it is
possible to have more then one injector - one per module.

-igor

On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jason wrote:
> Hi, all:
> I have a class which is likes below:
>
>
> public class DetachableMemberModel extends LoadableDetachableModel {
>
>    private final long id;
>
>    public DetachableMemberModel(Member m) {
>        this(m.getId());
>    }
>
>    public DetachableMemberModel(long id) {
>        if (id == 0) {
>            throw new IllegalArgumentException();
>        }
>        this.id = id;
>    }
>
>   �...@override
>    public int hashCode() {
>        return Long.valueOf(id).hashCode();
>    }
>
>   �...@override
>    public boolean equals(final Object obj) {
>        if (obj == this) {
>            return true;
>        } else if (obj == null) {
>            return false;
>        } else if (obj instanceof DetachableMemberModel) {
>            DetachableMemberModel other = (DetachableMemberModel) obj;
>            return other.id == id;
>        }
>        return false;
>    }
>
>   �...@override
>    protected Member load() {
>        // I do not know how to inject this service to
> Object DetachableMemberModel
>        return memberService.query(id);
>    }
> }
>
> please see the last method of this class, I do not know how to inject
> memberService to this class.
> If I use @Inject private MemberService memberService, I have to inject this
> class to the WebPage, but I can not bind DetachableMemberModel to any
> interface.
>
> So, I do not know to to implement this, can anybody help me? Thanks very
> much.
>
> --
> --
> Enjoy. Thanks!
>
> Haulyn Microproduction
>
> Mobile: +086-15864011231
> email: saharab...@gmail.com,
>         hmp.hau...@foxmail.com
> website: http://haulynjason.net
> gtalk: saharab...@gmail.com
> yahoo: jia_hao...@yahoo.com
> msn: saharab...@gmail.com
> skype: saharabear
> QQ: 378606292
>
> Haulyn Jason
>

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



Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Haulyn R. Jason
Hi,
I got these blow:
java.lang.IllegalStateException: InjectorHolder has not been assigned an
injector. Use InjectorHolder.setInjector() to assign an injector. In most
cases this should be done once inside SpringWebApplication subclass's init()
method.


I didn't use spring. I use wicket with guice. I do not know how to solve
this.

confused by:... done once inside SpringWebApplication subclass's init()
method



On Tue, Aug 18, 2009 at 12:10 AM, Haulyn R. Jason wrote:

> I try to add this line, but it doesn't work.
> I try to test a simple service binding in guice module, it works well with
> : @Inject ITestService testService;
>
>
> Thanks.
>
>
>
> On Tue, Aug 18, 2009 at 12:01 AM, Arie Fishler  wrote:
>
>> in the ctor just add this line
>>
>> InjectorHolder.*getInjector*().inject(*this*);
>>
>>
>> On Mon, Aug 17, 2009 at 6:26 PM, Haulyn R. Jason > >wrote:
>>
>> > Hi, all:
>> > I have a class which is likes below:
>> >
>> >
>> > public class DetachableMemberModel extends
>> LoadableDetachableModel
>> > {
>> >
>> >private final long id;
>> >
>> >public DetachableMemberModel(Member m) {
>> >this(m.getId());
>> >}
>> >
>> >public DetachableMemberModel(long id) {
>> >if (id == 0) {
>> >throw new IllegalArgumentException();
>> >}
>> >this.id = id;
>> >}
>> >
>> >@Override
>> >public int hashCode() {
>> >return Long.valueOf(id).hashCode();
>> >}
>> >
>> >@Override
>> >public boolean equals(final Object obj) {
>> >if (obj == this) {
>> >return true;
>> >} else if (obj == null) {
>> >return false;
>> >} else if (obj instanceof DetachableMemberModel) {
>> >DetachableMemberModel other = (DetachableMemberModel) obj;
>> >return other.id == id;
>> >}
>> >return false;
>> >}
>> >
>> >@Override
>> >protected Member load() {
>> >// I do not know how to inject this service to
>> > Object DetachableMemberModel
>> >return memberService.query(id);
>> >}
>> > }
>> >
>> > please see the last method of this class, I do not know how to inject
>> > memberService to this class.
>> > If I use @Inject private MemberService memberService, I have to inject
>> this
>> > class to the WebPage, but I can not bind DetachableMemberModel to any
>> > interface.
>> >
>> > So, I do not know to to implement this, can anybody help me? Thanks very
>> > much.
>> >
>> > --
>> > --
>> > Enjoy. Thanks!
>> >
>> > Haulyn Microproduction
>> >
>> > Mobile: +086-15864011231
>> > email: saharab...@gmail.com,
>> > hmp.hau...@foxmail.com
>> > website: http://haulynjason.net
>> > gtalk: saharab...@gmail.com
>> > yahoo: jia_hao...@yahoo.com
>> > msn: saharab...@gmail.com
>> > skype: saharabear
>> > QQ: 378606292
>> >
>> > Haulyn Jason
>> >
>>
>
>
>
> --
> --
> Enjoy. Thanks!
>
> Haulyn Microproduction
>
> Mobile: +086-15864011231
> email: saharab...@gmail.com,
>  hmp.hau...@foxmail.com
> website: http://haulynjason.net
> gtalk: saharab...@gmail.com
> yahoo: jia_hao...@yahoo.com
> msn: saharab...@gmail.com
> skype: saharabear
> QQ: 378606292
>
> Haulyn Jason
>
>
>


-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Haulyn R. Jason
I try to add this line, but it doesn't work.
I try to test a simple service binding in guice module, it works well with :
@Inject ITestService testService;


Thanks.



On Tue, Aug 18, 2009 at 12:01 AM, Arie Fishler  wrote:

> in the ctor just add this line
>
> InjectorHolder.*getInjector*().inject(*this*);
>
>
> On Mon, Aug 17, 2009 at 6:26 PM, Haulyn R. Jason  >wrote:
>
> > Hi, all:
> > I have a class which is likes below:
> >
> >
> > public class DetachableMemberModel extends
> LoadableDetachableModel
> > {
> >
> >private final long id;
> >
> >public DetachableMemberModel(Member m) {
> >this(m.getId());
> >}
> >
> >public DetachableMemberModel(long id) {
> >if (id == 0) {
> >throw new IllegalArgumentException();
> >}
> >this.id = id;
> >}
> >
> >@Override
> >public int hashCode() {
> >return Long.valueOf(id).hashCode();
> >}
> >
> >@Override
> >public boolean equals(final Object obj) {
> >if (obj == this) {
> >return true;
> >} else if (obj == null) {
> >return false;
> >} else if (obj instanceof DetachableMemberModel) {
> >DetachableMemberModel other = (DetachableMemberModel) obj;
> >return other.id == id;
> >}
> >return false;
> >}
> >
> >@Override
> >protected Member load() {
> >// I do not know how to inject this service to
> > Object DetachableMemberModel
> >return memberService.query(id);
> >}
> > }
> >
> > please see the last method of this class, I do not know how to inject
> > memberService to this class.
> > If I use @Inject private MemberService memberService, I have to inject
> this
> > class to the WebPage, but I can not bind DetachableMemberModel to any
> > interface.
> >
> > So, I do not know to to implement this, can anybody help me? Thanks very
> > much.
> >
> > --
> > --
> > Enjoy. Thanks!
> >
> > Haulyn Microproduction
> >
> > Mobile: +086-15864011231
> > email: saharab...@gmail.com,
> > hmp.hau...@foxmail.com
> > website: http://haulynjason.net
> > gtalk: saharab...@gmail.com
> > yahoo: jia_hao...@yahoo.com
> > msn: saharab...@gmail.com
> > skype: saharabear
> > QQ: 378606292
> >
> > Haulyn Jason
> >
>



-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Arie Fishler
in the ctor just add this line

InjectorHolder.*getInjector*().inject(*this*);


On Mon, Aug 17, 2009 at 6:26 PM, Haulyn R. Jason wrote:

> Hi, all:
> I have a class which is likes below:
>
>
> public class DetachableMemberModel extends LoadableDetachableModel
> {
>
>private final long id;
>
>public DetachableMemberModel(Member m) {
>this(m.getId());
>}
>
>public DetachableMemberModel(long id) {
>if (id == 0) {
>throw new IllegalArgumentException();
>}
>this.id = id;
>}
>
>@Override
>public int hashCode() {
>return Long.valueOf(id).hashCode();
>}
>
>@Override
>public boolean equals(final Object obj) {
>if (obj == this) {
>return true;
>} else if (obj == null) {
>return false;
>} else if (obj instanceof DetachableMemberModel) {
>DetachableMemberModel other = (DetachableMemberModel) obj;
>return other.id == id;
>}
>return false;
>}
>
>@Override
>protected Member load() {
>// I do not know how to inject this service to
> Object DetachableMemberModel
>return memberService.query(id);
>}
> }
>
> please see the last method of this class, I do not know how to inject
> memberService to this class.
> If I use @Inject private MemberService memberService, I have to inject this
> class to the WebPage, but I can not bind DetachableMemberModel to any
> interface.
>
> So, I do not know to to implement this, can anybody help me? Thanks very
> much.
>
> --
> --
> Enjoy. Thanks!
>
> Haulyn Microproduction
>
> Mobile: +086-15864011231
> email: saharab...@gmail.com,
> hmp.hau...@foxmail.com
> website: http://haulynjason.net
> gtalk: saharab...@gmail.com
> yahoo: jia_hao...@yahoo.com
> msn: saharab...@gmail.com
> skype: saharabear
> QQ: 378606292
>
> Haulyn Jason
>


How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Haulyn R. Jason
Hi, all:
I have a class which is likes below:


public class DetachableMemberModel extends LoadableDetachableModel {

private final long id;

public DetachableMemberModel(Member m) {
this(m.getId());
}

public DetachableMemberModel(long id) {
if (id == 0) {
throw new IllegalArgumentException();
}
this.id = id;
}

@Override
public int hashCode() {
return Long.valueOf(id).hashCode();
}

@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
} else if (obj == null) {
return false;
} else if (obj instanceof DetachableMemberModel) {
DetachableMemberModel other = (DetachableMemberModel) obj;
return other.id == id;
}
return false;
}

@Override
protected Member load() {
// I do not know how to inject this service to
Object DetachableMemberModel
return memberService.query(id);
}
}

please see the last method of this class, I do not know how to inject
memberService to this class.
If I use @Inject private MemberService memberService, I have to inject this
class to the WebPage, but I can not bind DetachableMemberModel to any
interface.

So, I do not know to to implement this, can anybody help me? Thanks very
much.

-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: Use Guice....

2009-07-24 Thread Peter Ertl

salve!


Am 24.07.2009 um 10:55 schrieb Jeroen Steenbeeke:

If Dependency Injection is all you want to do then indeed Spring may  
not be
the best choice, but in my case at least I use it for more than  
that, as I

also use the Spring Transaction Manager and Spring Mailer.
Also, Spring does seem to cater mainly to XML fetishists, but they  
do offer

alternatives:

http://www.springframework.org/schema/beans";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:context="http://www.springframework.org/schema/context";
 xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring- 
context-2.5.xsd

">



After this, you just use @Component and @Autowired annotations for  
your
beans and dependencies, respectively. No need to muck around in XML  
aside

from some initial config.
Spring does not need to be painful.
Cheers, Jeroen

DISCLAIMER: I have never used Guice

2009/7/23 francisco treacy 


http://fiber-space.de/wordpress/?p=1016

2009/7/23 Uwe Schäfer :

Johannes Schneider schrieb:


It's the better Spring ;-)


agreed!

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




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





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



Re: Use Guice....

2009-07-24 Thread Jeroen Steenbeeke
If Dependency Injection is all you want to do then indeed Spring may not be
the best choice, but in my case at least I use it for more than that, as I
also use the Spring Transaction Manager and Spring Mailer.
Also, Spring does seem to cater mainly to XML fetishists, but they do offer
alternatives:
 
http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:context="http://www.springframework.org/schema/context";
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
">



After this, you just use @Component and @Autowired annotations for your
beans and dependencies, respectively. No need to muck around in XML aside
from some initial config.
Spring does not need to be painful.
Cheers, Jeroen

DISCLAIMER: I have never used Guice

2009/7/23 francisco treacy 

> http://fiber-space.de/wordpress/?p=1016
>
> 2009/7/23 Uwe Schäfer :
> > Johannes Schneider schrieb:
> >>
> >> It's the better Spring ;-)
> >
> > agreed!
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Use Guice....

2009-07-23 Thread francisco treacy
http://fiber-space.de/wordpress/?p=1016

2009/7/23 Uwe Schäfer :
> Johannes Schneider schrieb:
>>
>> It's the better Spring ;-)
>
> agreed!
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Use Guice....

2009-07-23 Thread Uwe Schäfer

Johannes Schneider schrieb:

It's the better Spring ;-)


agreed!

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



Use Guice....

2009-07-23 Thread Johannes Schneider
It's the better Spring ;-)

Dane Laverty wrote:
> Due to the fact that nearly every substantial sample Wicket app is
> Spring-based, I imagine that there's something awesome about using Spring.
> In fact, Wicket is what has finally gotten me to start learning Spring.
> 
> I think I understand the basics of dependency injection -- configure your
> objects in xml files and then inject them into your classes -- but I'm still
> not clear on the advantage of it. I've read quite a ways into "Spring in
> Action", and the author seems to assume that the reader will automatically
> see why xml-based dependency injection is great thing. I must just be
> missing something here. What I love about Wicket is being free from xml
> files. Can anyone give me a concise explanation of how the advantages of
> Spring are worth introducing a new layer into my applications?
> 
> Dane
> 

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