You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by trsvax <tr...@gmail.com> on 2012/08/14 18:01:55 UTC

Library binder and IDE helper

https://github.com/trsvax/tapestry-librarybinder

There was a discussion about IDE help on another thread. 
I had thought about this before so while I was waiting for 
My wife at the airport I started one. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Library binder and IDE helper

Posted by trsvax <tr...@gmail.com>.
I also reduces clutter in your page/component classes. I was already using
this for DAOs because I have one DAO per entity type. Some pages would have
4 or 5 @Injects for DOAs. Now they have one.

Secondly it defines the public API. If you use T5 you do not have access to
private services.

Lastly since it also creates services there is really no development
overhead in using it. Instead of

binder.bind(Foo.class,FooImpl.class)

you have

@Binder(implementation=FooImpl.class)
public Foo foo();

I'm guessing there is some overhead to this but there must be some overhead
in @Inject also. I suspect in most cases is it does not make much difference
one way or the other, but since you can still use services with @Inject

so you can always do this
@Inject Foo foo;

for ( i=0; i < 1000000; i++) {
   foo.method()
}
instead of
for ( i=0; i < 1000000; i++) {
   t5.foo().method()
}



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715449.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Library binder and IDE helper

Posted by Robert Zeigler <ro...@roxanemy.com>.
The point is that you may not know it.
You inject T5, and then use IDE code completion and inline help to determine what you need.

Robert

On Aug 15, 2012, at 8/158:29 AM , Alex Kotchnev wrote:

> I don't quite get it. If , as a user, I know that I need a
> ValueEncoderFactory, why is it helpful to inject T5, and call
> valueEncoderFactory() instead of declaring a field of type
> ValueEncoderFactory and marking it up w/ @Inject ?
> 
> Cheers,
> 
> Alex K
> 
> On Tue, Aug 14, 2012 at 7:30 PM, Lenny Primak <lp...@hope.nyc.ny.us>wrote:
> 
>> I don't want to duplicate your efforts.  I would love it if the library
>> was in maven central and just use it.
>> It would also be great for this to be part of the core tapestry, I think
>> it would simplify the usage greatly,
>> especially for beginners.
>> 
>> 
>> On Aug 14, 2012, at 7:28 PM, trsvax <tr...@gmail.com> wrote:
>> 
>>> I checked in the last of the T5 public services.
>>> 
>>> Lenny if you want to use some of the code feel free. I'll add the Apache
>> 2
>>> license header in the morning.
>>> 
>>> 
>>> 
>>> --
>>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715424.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


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


Re: Library binder and IDE helper

Posted by Alex Kotchnev <ak...@gmail.com>.
I don't quite get it. If , as a user, I know that I need a
ValueEncoderFactory, why is it helpful to inject T5, and call
valueEncoderFactory() instead of declaring a field of type
ValueEncoderFactory and marking it up w/ @Inject ?

Cheers,

Alex K

On Tue, Aug 14, 2012 at 7:30 PM, Lenny Primak <lp...@hope.nyc.ny.us>wrote:

> I don't want to duplicate your efforts.  I would love it if the library
> was in maven central and just use it.
> It would also be great for this to be part of the core tapestry, I think
> it would simplify the usage greatly,
> especially for beginners.
>
>
> On Aug 14, 2012, at 7:28 PM, trsvax <tr...@gmail.com> wrote:
>
> > I checked in the last of the T5 public services.
> >
> > Lenny if you want to use some of the code feel free. I'll add the Apache
> 2
> > license header in the morning.
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715424.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Library binder and IDE helper

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I don't want to duplicate your efforts.  I would love it if the library was in maven central and just use it.
It would also be great for this to be part of the core tapestry, I think it would simplify the usage greatly,
especially for beginners.


On Aug 14, 2012, at 7:28 PM, trsvax <tr...@gmail.com> wrote:

> I checked in the last of the T5 public services.
> 
> Lenny if you want to use some of the code feel free. I'll add the Apache 2
> license header in the morning.
> 
> 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715424.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


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


Re: Library binder and IDE helper

Posted by trsvax <tr...@gmail.com>.
I checked in the last of the T5 public services.

Lenny if you want to use some of the code feel free. I'll add the Apache 2
license header in the morning.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715424.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Library binder and IDE helper

Posted by trsvax <tr...@gmail.com>.
I think I can generate this file from the Javadocs but I have not tried that.
If so the moving target does not really matter. 

Also since the library will bind all the services interfaces from the
methods in the Interface file it really becomes the definition for the
Library/Module API so there is no moving target. You could even mark 
services as protected like this

protected MyService dontCallMe();

What really happens is you move the service bindings from the AppModule into
an Interface. This does several things

1. Specifies the public/protected APIs for a library/Module in a way that an
IDE can use.
2. Allows you do declare the library interface instead of coding it.
3. Removes clutter in page/components by reducing the number of @Injects
4. I think it does this in a backward compatible way because you can still
use the individual services
and bind them in your AppModule.

I'll add support for @Marker

I'll also see about putting this in Maven Central via Sonatype.org. It's
also been on my TODO list.

Barry
  



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715419.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Library binder and IDE helper

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
As Thiago said before this moving target isn't moving very fast :)



On Aug 14, 2012, at 12:08 PM, Howard Lewis Ship <hl...@gmail.com> wrote:

> Interesting, though (of course), the available interfaces are a moving
> target.  You should honor marker annotations on the interface methods
> to help identify which service it injected for each method.
> 
> On Tue, Aug 14, 2012 at 9:01 AM, trsvax <tr...@gmail.com> wrote:
>> https://github.com/trsvax/tapestry-librarybinder
>> 
>> There was a discussion about IDE help on another thread.
>> I had thought about this before so while I was waiting for
>> My wife at the airport I started one.
>> 
>> 
>> 
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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


Re: Library binder and IDE helper

Posted by Howard Lewis Ship <hl...@gmail.com>.
Interesting, though (of course), the available interfaces are a moving
target.  You should honor marker annotations on the interface methods
to help identify which service it injected for each method.

On Tue, Aug 14, 2012 at 9:01 AM, trsvax <tr...@gmail.com> wrote:
> https://github.com/trsvax/tapestry-librarybinder
>
> There was a discussion about IDE help on another thread.
> I had thought about this before so while I was waiting for
> My wife at the airport I started one.
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: Library binder and IDE helper

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 14 Aug 2012 15:15:28 -0300, Thiago H de Paula Figueiredo  
<th...@gmail.com> wrote:

> On Tue, 14 Aug 2012 14:45:04 -0300, Lenny Primak  
> <lp...@hope.nyc.ny.us> wrote:
>
>> So seems like you are running with this faster than I am. Should I  
>> close my issue them?
>
> I thought what trsvax did is different from what you wanted, Lenny.

Being wrong or right, trxvax, thanks for the contribution. :)

-- 
Thiago H. de Paula Figueiredo

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


Re: Library binder and IDE helper

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Its in the library

-----Original message-----
From: Thiago H de Paula Figueiredo <th...@gmail.com>
To: Tapestry users <us...@tapestry.apache.org>
Sent: Tue, Aug 14, 2012 20:15:49 GMT+00:00
Subject: Re: Library binder and IDE helper

On Tue, 14 Aug 2012 16:17:43 -0300, Robert Zeigler  
<ro...@roxanemy.com> wrote:

> This is what the T5.java service is doing already. It's a single  
> injectable service that has methods to gain access to many (all?) the  
> public services.

I didn't know about that. Does it exist since which Tapestry version? Or  
is it in another project?

-- 
Thiago H. de Paula Figueiredo

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



Re: Library binder and IDE helper

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 14 Aug 2012 16:17:43 -0300, Robert Zeigler  
<ro...@roxanemy.com> wrote:

> This is what the T5.java service is doing already. It's a single  
> injectable service that has methods to gain access to many (all?) the  
> public services.

I didn't know about that. Does it exist since which Tapestry version? Or  
is it in another project?

-- 
Thiago H. de Paula Figueiredo

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


Re: Library binder and IDE helper

Posted by Robert Zeigler <ro...@roxanemy.com>.
On Aug 14, 2012, at 8/142:07 PM , Thiago H de Paula Figueiredo wrote:

> On Tue, 14 Aug 2012 15:19:04 -0300, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
> 
>> Seems like he has a T5 interface that as all kinds of getters.  Seems like what I am going for or am I confused?
> 
> I think it can be used for speeding the implementation of what you want. The other part would be to define an interface like this:
> 
> public inteface TapestryServices {
> 	Request request(); // or getRequest()
> 	ApplicationStateManager applicationStateManager();
> 	...
> }
> 

This is what the T5.java service is doing already. It's a single injectable service that has methods to gain access to many (all?) the public services.

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


Re: Library binder and IDE helper

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 14 Aug 2012 15:19:04 -0300, Lenny Primak <lp...@hope.nyc.ny.us>  
wrote:

> Seems like he has a T5 interface that as all kinds of getters.  Seems  
> like what I am going for or am I confused?

I think it can be used for speeding the implementation of what you want.  
The other part would be to define an interface like this:

public inteface TapestryServices {
	Request request(); // or getRequest()
	ApplicationStateManager applicationStateManager();
	...
}

> One thing that I would like is to merge some of this work.  Barry's  
> (trsvax) stuff isn't on Maven Central, which makes things
> a little more difficult to work with.

That would be nice too . . .

-- 
Thiago H. de Paula Figueiredo

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


Re: Library binder and IDE helper

Posted by trsvax <tr...@gmail.com>.
OK I got a sonatype account and the snapshot module is at

https://oss.sonatype.org/content/repositories/snapshots/

<dependency>
    	   <groupId>com.trsvax</groupId>
    	   <artifactId>tapestry-librarybinder</artifactId>
    	   <version>5.3.4-SNAPSHOT</version>
</dependency>

I'll make a release version shortly

Barry



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397p5715494.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Library binder and IDE helper

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Seems like he has a T5 interface that as all kinds of getters.  Seems like what I am going for or am I confused?
One thing that I would like is to merge some of this work.  Barry's (trsvax) stuff isn't on Maven Central, which makes things
a little more difficult to work with.

On Aug 14, 2012, at 2:15 PM, "Thiago H de Paula Figueiredo" <th...@gmail.com> wrote:

> On Tue, 14 Aug 2012 14:45:04 -0300, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
> 
>> So seems like you are running with this faster than I am. Should I close my issue them?
> 
> I thought what trsvax did is different from what you wanted, Lenny.


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


Re: Library binder and IDE helper

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 14 Aug 2012 14:45:04 -0300, Lenny Primak <lp...@hope.nyc.ny.us>  
wrote:

> So seems like you are running with this faster than I am. Should I close  
> my issue them?

I thought what trsvax did is different from what you wanted, Lenny.

-- 
Thiago H. de Paula Figueiredo

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


Re: Library binder and IDE helper

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
So seems like you are running with this faster than I am. Should I close my issue them?


On Aug 14, 2012, at 11:01 AM, trsvax <tr...@gmail.com> wrote:

> https://github.com/trsvax/tapestry-librarybinder
> 
> There was a discussion about IDE help on another thread. 
> I had thought about this before so while I was waiting for 
> My wife at the airport I started one. 
> 
> 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Library-binder-and-IDE-helper-tp5715397.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands , e-mail: users-help@tapestry.apache.org
> 

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