You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Barry Books <tr...@gmail.com> on 2013/10/14 14:45:57 UTC

Re: Proposal for ObjectFactory service in 5.4

finally got around to this and it does not work in 5.4


   -
   org.apache.tapestry5.ioc.internal.services.ValueObjectProvider.provide(ValueObjectProvider.java:47)
   -
   org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:52)
   -
   org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:45)
   - com.trsvax.pages.work.WorkView.onSuccess(WorkView.java:214)

*
*
because

47<https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=blob;f=tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ValueObjectProvider.java;h=828c6697af39dc36775aa4647b2ea29ca7c173b3;hb=HEAD#l47>
       Value annotation =
annotationProvider.getAnnotation(Value.class);

but this does

invoice = provider.provide(Invoice.*class*, *new* AnnotationProvider() {


  @Override

  *public* <T *extends* Annotation> T getAnnotation(Class<T> arg0) {

  *return* *null*;

  }

}, *null*, *true*);


While it works it's not the most convenient method for creating a new
object. I'm guessing your code works in 5.3. Should I create a JIRA?


On Mon, Sep 30, 2013 at 8:25 AM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Mon, 30 Sep 2013 09:50:14 -0300, Barry Books <tr...@gmail.com> wrote:
>
>  Thanks for the example. I think that will meet my needs.
>>
>
> Yay! :)
>
>
>  I don't think I
>> would have ever figured that out from the existing documentation.
>>
>
> It's one of the hidden gems of Tapestry and Tapestry-IoC. I just
> remembered it because I remembered that in Tapestry-IoC you can provide any
> injection yourself as long as you contributed something to some service,
> then I remembered about ObjectProvider and MasterObjectProvider.
>
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.**apache.org<de...@tapestry.apache.org>
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Proposal for ObjectFactory service in 5.4

Posted by Barry Books <tr...@gmail.com>.
passing null for the annotation provider results in a null pointer
exception in 5.4


On Mon, Oct 14, 2013 at 9:06 AM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Mon, 14 Oct 2013 09:56:05 -0300, Barry Books <tr...@gmail.com> wrote:
>
>  found NullAnnotaionProvider which is somewhat better
>>
>> invoice = provider.provide(Invoice.***class*, *new*
>> NullAnnotationProvider(),
>> *null*, *true*);
>>
>
> Or just pass null. As I said before in this thread, I don't see the need
> for a second way/service for providing objects. Maybe just another method
> in ObjectLocator with fewer parameters (just the type), passing default
> values.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.**apache.org<de...@tapestry.apache.org>
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Proposal for ObjectFactory service in 5.4

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 14 Oct 2013 09:56:05 -0300, Barry Books <tr...@gmail.com> wrote:

> found NullAnnotaionProvider which is somewhat better
>
> invoice = provider.provide(Invoice.*class*, *new*  
> NullAnnotationProvider(),
> *null*, *true*);

Or just pass null. As I said before in this thread, I don't see the need  
for a second way/service for providing objects. Maybe just another method  
in ObjectLocator with fewer parameters (just the type), passing default  
values.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Proposal for ObjectFactory service in 5.4

Posted by Barry Books <tr...@gmail.com>.
found NullAnnotaionProvider which is somewhat better

invoice = provider.provide(Invoice.*class*, *new* NullAnnotationProvider(),
*null*, *true*);


On Mon, Oct 14, 2013 at 7:45 AM, Barry Books <tr...@gmail.com> wrote:

> finally got around to this and it does not work in 5.4
>
>
>    -
>    org.apache.tapestry5.ioc.internal.services.ValueObjectProvider.provide(ValueObjectProvider.java:47)
>    -
>    org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:52)
>    -
>    org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:45)
>    - com.trsvax.pages.work.WorkView.onSuccess(WorkView.java:214)
>
> *
> *
> because
>
>  47<https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=blob;f=tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ValueObjectProvider.java;h=828c6697af39dc36775aa4647b2ea29ca7c173b3;hb=HEAD#l47>        Value annotation = annotationProvider.getAnnotation(Value.class);
>
> but this does
>
> invoice = provider.provide(Invoice.*class*, *new* AnnotationProvider() {
>
>
>   @Override
>
>   *public* <T *extends* Annotation> T getAnnotation(Class<T> arg0) {
>
>   *return* *null*;
>
>   }
>
> }, *null*, *true*);
>
>
> While it works it's not the most convenient method for creating a new
> object. I'm guessing your code works in 5.3. Should I create a JIRA?
>
>
> On Mon, Sep 30, 2013 at 8:25 AM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
>> On Mon, 30 Sep 2013 09:50:14 -0300, Barry Books <tr...@gmail.com> wrote:
>>
>>  Thanks for the example. I think that will meet my needs.
>>>
>>
>> Yay! :)
>>
>>
>>  I don't think I
>>> would have ever figured that out from the existing documentation.
>>>
>>
>> It's one of the hidden gems of Tapestry and Tapestry-IoC. I just
>> remembered it because I remembered that in Tapestry-IoC you can provide any
>> injection yourself as long as you contributed something to some service,
>> then I remembered about ObjectProvider and MasterObjectProvider.
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.**apache.org<de...@tapestry.apache.org>
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>>
>