On 30/08/2012 12:47, Christopher Piggott wrote:
> On Mon, Aug 27, 2012 at 3:08 AM, John Lister <john.lister_at_kickstone.com> wrote:
>> I'm no expert, but isn't that just a weld proxy to the actual object you
>> want? You should be able to call any method from your real object on it and
>> weld will route it to the actual instance. I've not had any coffee yet this
>> morning so may be missing something completely here.
> Hi John,
>
> Yeah it sort of does, but I need a way to refer to it ... and casting
> to that proxy didn't seem to work. I don't know how to use it. What
> I was hoping was that I could just declare it as a @ParentRef of the
> type that I think it should be, and if it's a proxy (i.e. a subclass)
> then it's assignable so that should have worked.
>
You should be able to use the original class name and all method calls
will be silently routed through the proxy. Pretty much everything that
is injected is proxied, this allows the weld/jersey to use clever tricks
like thread local storage for example.
Eg:
@ParentRef MySubclass mysubclass;
mysubclass.myFunc(blah)
The only downside I've found is debugging (well in netbeans) is tricky
as they confuse the debugger slightly.
John