You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jun Tsai (JIRA)" <de...@tapestry.apache.org> on 2007/05/26 07:25:16 UTC
[jira] Created: (TAPESTRY-1518) T5 can't support generic type page
T5 can't support generic type page
----------------------------------
Key: TAPESTRY-1518
URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
Project: Tapestry
Issue Type: Bug
Affects Versions: 5.0.4, 5.0.3, 5.0
Reporter: Jun Tsai
Base.java
class abstract Base<T>{
private T entity;
public void setEntity(T t){
this.entity=entity;
}
public T getEntity(T t){
return this.entity;
}
protected abstract Class<T> getEntityClass();
onPrepareFromMyForm(){
if(this.entity == null){
try{
this.entity=getEntityClass().newInstance();
}catch(Exception e){
throw new RuntimeException(e);
}
}
}
.....
}
ProductPage.java
public class ProductPage extends Base<Product>{
protected Class<Product> getEntityClass(){
return Product.class;
}
}
ProductPage.html
<t:form t:id="MyForm">
<t:errors/>
<t:label for="input"/>
<input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
<br/>
<input type="submit" value="Suubmit"/>
</t:form>
exception:
Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
Re: [jira] Updated: (TAPESTRY-1518) Add support for JDK 1.5 Generics when defining pages and accessing bean properties
Posted by Davor Hrg <hr...@gmail.com>.
hi,
I seem to created a duplicate of this ....
https://issues.apache.org/jira/browse/TAPESTRY-2053
however, I've put a small patch in there
and pointed out some troubles that happened along the way...
maybe it helps...
I've broken my eclipse trying to load tapestry as project...
so there's no test case in there... just code that made it work for my
use case...
Davor Hrg
On Jan 24, 2008 11:19 PM, Howard M. Lewis Ship (JIRA)
<de...@tapestry.apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Howard M. Lewis Ship updated TAPESTRY-1518:
> -------------------------------------------
>
> Component/s: tapestry-ioc
> tapestry-core
> Summary: Add support for JDK 1.5 Generics when defining pages and accessing bean properties (was: T5 can't support generic type page)
>
> > Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> > ----------------------------------------------------------------------------------
> >
> > Key: TAPESTRY-1518
> > URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> > Project: Tapestry
> > Issue Type: Bug
> > Components: tapestry-core, tapestry-ioc
> > Affects Versions: 5.0, 5.0.3, 5.0.4
> > Reporter: Jun Tsai
> > Assignee: Howard M. Lewis Ship
> >
> > Base.java
> > class abstract Base<T>{
> > private T entity;
> > public void setEntity(T t){
> > this.entity=entity;
> > }
> > public T getEntity(T t){
> > return this.entity;
> > }
> > protected abstract Class<T> getEntityClass();
> > onPrepareFromMyForm(){
> > if(this.entity == null){
> > try{
> > this.entity=getEntityClass().newInstance();
> > }catch(Exception e){
> > throw new RuntimeException(e);
> > }
> > }
> > }
> > .....
> > }
> > ProductPage.java
> > public class ProductPage extends Base<Product>{
> > protected Class<Product> getEntityClass(){
> > return Product.class;
> > }
> > }
> > ProductPage.html
> > <t:form t:id="MyForm">
> > <t:errors/>
> > <t:label for="input"/>
> > <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> > <br/>
> > <input type="submit" value="Submit"/>
> > </t:form>
> > exception:
> > Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> > When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> > I think the method should be after onPrepareFromMyForm method.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) Add support for JDK 1.5 Generics
when defining pages and accessing bean properties
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562271#action_12562271 ]
Howard M. Lewis Ship commented on TAPESTRY-1518:
------------------------------------------------
I'm slogging away at this one.
Something that will work today is that you can make your base class abstract, with abstract getters and setters for the parameterized type, In this way, when you implement the abstract class, you will provide new methods that have the correct return type (even after type erasure) ... but then you need to redefine the field in each subclass, which is most of the work I think you are trying to avoid.
What I'm seeing is that the data available at runtime is very limited; in the case of a non-abstract base class, the Method objects are the Methods as defined on the base class (as type Object), which kind of makes sense.
> Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> ----------------------------------------------------------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core, tapestry-ioc
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) Add support for JDK 1.5 Generics
when defining pages and accessing bean properties
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562324#action_12562324 ]
Howard M. Lewis Ship commented on TAPESTRY-1518:
------------------------------------------------
This is coming along pretty nicely. The question is going to be how much of the information will be available at runtime. Specifically, using @Inject or @ApplicatinState with a generic type will probably not work.
> Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> ----------------------------------------------------------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core, tapestry-ioc
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Updated: (TAPESTRY-1518) T5 can't support generic type page
Posted by "Jun Tsai (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jun Tsai updated TAPESTRY-1518:
-------------------------------
Description:
Base.java
class abstract Base<T>{
private T entity;
public void setEntity(T t){
this.entity=entity;
}
public T getEntity(T t){
return this.entity;
}
protected abstract Class<T> getEntityClass();
onPrepareFromMyForm(){
if(this.entity == null){
try{
this.entity=getEntityClass().newInstance();
}catch(Exception e){
throw new RuntimeException(e);
}
}
}
.....
}
ProductPage.java
public class ProductPage extends Base<Product>{
protected Class<Product> getEntityClass(){
return Product.class;
}
}
ProductPage.html
<t:form t:id="MyForm">
<t:errors/>
<t:label for="input"/>
<input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
<br/>
<input type="submit" value="Submit"/>
</t:form>
exception:
Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
I think the method should be after onPrepareFromMyForm method.
was:
Base.java
class abstract Base<T>{
private T entity;
public void setEntity(T t){
this.entity=entity;
}
public T getEntity(T t){
return this.entity;
}
protected abstract Class<T> getEntityClass();
onPrepareFromMyForm(){
if(this.entity == null){
try{
this.entity=getEntityClass().newInstance();
}catch(Exception e){
throw new RuntimeException(e);
}
}
}
.....
}
ProductPage.java
public class ProductPage extends Base<Product>{
protected Class<Product> getEntityClass(){
return Product.class;
}
}
ProductPage.html
<t:form t:id="MyForm">
<t:errors/>
<t:label for="input"/>
<input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
<br/>
<input type="submit" value="Suubmit"/>
</t:form>
exception:
Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
I think the method should be after onPrepareFromMyForm method.
> T5 can't support generic type page
> ----------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Affects Versions: 5.0.3, 5.0.4, 5.0
> Reporter: Jun Tsai
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Closed: (TAPESTRY-1518) Add support for JDK 1.5 Generics
when defining pages and accessing bean properties
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship closed TAPESTRY-1518.
------------------------------------------
Resolution: Fixed
Fix Version/s: 5.0.10
I'm very happy with this ... the integration tests now include an example of a GenericEditor<T> base class and a TrackEditor extends GenericEditor<Track>. You get all the functionality with zero code, just define your concrete class and lock down the generic parameters. This will be huge.
> Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> ----------------------------------------------------------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core, tapestry-ioc
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
> Fix For: 5.0.10
>
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Updated: (TAPESTRY-1518) Add support for JDK 1.5 Generics
when defining pages and accessing bean properties
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship updated TAPESTRY-1518:
-------------------------------------------
Component/s: tapestry-ioc
tapestry-core
Summary: Add support for JDK 1.5 Generics when defining pages and accessing bean properties (was: T5 can't support generic type page)
> Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> ----------------------------------------------------------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core, tapestry-ioc
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Assigned: (TAPESTRY-1518) T5 can't support generic type page
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship reassigned TAPESTRY-1518:
----------------------------------------------
Assignee: Howard M. Lewis Ship
> T5 can't support generic type page
> ----------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) T5 can't support generic type
page
Posted by "Jun Tsai (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499521 ]
Jun Tsai commented on TAPESTRY-1518:
------------------------------------
In javassist javadoc pages
I find:
public CtMethod[] getDeclaredMethods()
Gets all methods declared in the class. The inherited methods are not included.
public CtMethod[] getMethods()
Returns an array containing CtMethod objects representing all the non-private methods of the class. That array includes pon-private methods inherited from the superclasses.
I guess InternalClassTransformationImpl can use CtClass.getMethods() method to find all methods (include inherited methods.)
> T5 can't support generic type page
> ----------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Affects Versions: 5.0.3, 5.0.4, 5.0
> Reporter: Jun Tsai
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) Add support for JDK 1.5 Generics
when defining pages and accessing bean properties
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562341#action_12562341 ]
Howard M. Lewis Ship commented on TAPESTRY-1518:
------------------------------------------------
BTW, the type of property is communicated out properly ... that means that the BeanEditForm can instantiate the correct type of bean automatically, you don't need some of the code in your example (the getEntityClass() method).
> Add support for JDK 1.5 Generics when defining pages and accessing bean properties
> ----------------------------------------------------------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core, tapestry-ioc
> Affects Versions: 5.0, 5.0.3, 5.0.4
> Reporter: Jun Tsai
> Assignee: Howard M. Lewis Ship
> Fix For: 5.0.10
>
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) T5 can't support generic type
page
Posted by "Jun Tsai (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499522 ]
Jun Tsai commented on TAPESTRY-1518:
------------------------------------
wrong comment
see #1521
> T5 can't support generic type page
> ----------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Affects Versions: 5.0.3, 5.0.4, 5.0
> Reporter: Jun Tsai
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-1518) T5 can't support generic type
page
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499476 ]
Howard M. Lewis Ship commented on TAPESTRY-1518:
------------------------------------------------
This could be a bit of a problem because of type erasure.
> T5 can't support generic type page
> ----------------------------------
>
> Key: TAPESTRY-1518
> URL: https://issues.apache.org/jira/browse/TAPESTRY-1518
> Project: Tapestry
> Issue Type: Bug
> Affects Versions: 5.0.3, 5.0.4, 5.0
> Reporter: Jun Tsai
>
> Base.java
> class abstract Base<T>{
> private T entity;
> public void setEntity(T t){
> this.entity=entity;
> }
> public T getEntity(T t){
> return this.entity;
> }
> protected abstract Class<T> getEntityClass();
> onPrepareFromMyForm(){
> if(this.entity == null){
> try{
> this.entity=getEntityClass().newInstance();
> }catch(Exception e){
> throw new RuntimeException(e);
> }
> }
> }
> .....
> }
> ProductPage.java
> public class ProductPage extends Base<Product>{
> protected Class<Product> getEntityClass(){
> return Product.class;
> }
> }
> ProductPage.html
> <t:form t:id="MyForm">
> <t:errors/>
> <t:label for="input"/>
> <input t:type="textfield" t:id="input" value="entity.name" size="40" t:validate="required,minlength=3"/>
> <br/>
> <input type="submit" value="Submit"/>
> </t:form>
> exception:
> Could not convert 'entity.name' into a component parameter binding: Class java.lang.Object does not contain a property named 'name' (within property expression 'entity.name').
> When I debug the app,I fiind PropertyConduitSourceImpl.readMethodForTerm before onPrepareFromMyForm method.
> I think the method should be after onPrepareFromMyForm method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org