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<saharab...@gmail.com> wrote:
> Hi, all:
> I have a class which is likes below:
>
>
> public class DetachableMemberModel extends LoadableDetachableModel<Member> {
>
>    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

Reply via email to