You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by buckofive <kl...@yahoo.com> on 2008/03/07 01:59:55 UTC

[T5] Help getting generics to work

Hi all,

I'm wondering if this is even possible.   I read that java 1.5 generics
support was as added as of tapestry 5.0.10 but I am unable to get it to
work.  I always end up with this exception:
"Class java.lang.Object does not contain a property named 'id' (within
property expression 'genericsTest.instance.id').  Available properties:
class."

I have tried this with 5.0.10 and 5.0.11-SNAPSHOT.  I would greatly
appreciate any help, I'm sure its something silly that I'm missing.  

Thank you in advance!


Here is the code I am using:

public class Start
{
	private Generic<Test> genericsTest = new Generic<Test>(new Test(555));
	public Generic<Test> getGenericsTest() {return genericsTest;}
	public void setGenericsTest(Generic<Test> test) {this.genericsTest=test;}
}


public class Generic<T> {
	T instance;

	public Generic(T instance)
	{
		this.instance=instance;
	}
	
	public T getInstance() {return instance;}
	public void setInstance(T instance) {this.instance = instance;}	
}


public class Test
{
	int id;
	public Test(int id)
	{
		this.id = id;
	}
	public int getId() {return id;}
	public void setId(int id) {this.id = id;}
}

Start.tml:
	
	 Java 1.5 Generics Test: ${genericsTest.instance.id}
	


-- 
View this message in context: http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15885528.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: [T5] Help getting generics to work

Posted by Howard Lewis Ship <hl...@gmail.com>.
Anything is possible in the future, though the Java language people
have created a hideous, hard to support monster with Generics.

On Fri, Mar 7, 2008 at 3:54 PM, buckofive <kl...@yahoo.com> wrote:
>
>  Howard,
>
>  Thank you for the quick response!  Are there intentions to get Tapestry to
>  support generics for cases like this when its released?  It would really be
>  great to have this kind of support (I've already come across a few cases
>  where it would come in very handy).
>
>  Thanks again,
>  B
>
>
>
>
>
>  Howard Lewis Ship wrote:
>  >
>  > Tapestry only understands simple generics applied directly to your
>  > page or component class.
>  >
>  > On Thu, Mar 6, 2008 at 4:59 PM, buckofive <kl...@yahoo.com> wrote:
>  >>
>  >>
>  >>  Hi all,
>  >>
>  >>  I'm wondering if this is even possible.   I read that java 1.5 generics
>  >>  support was as added as of tapestry 5.0.10 but I am unable to get it to
>  >>  work.  I always end up with this exception:
>  >>  "Class java.lang.Object does not contain a property named 'id' (within
>  >>  property expression 'genericsTest.instance.id').  Available properties:
>  >>  class."
>  >>
>  >>  I have tried this with 5.0.10 and 5.0.11-SNAPSHOT.  I would greatly
>  >>  appreciate any help, I'm sure its something silly that I'm missing.
>  >>
>  >>  Thank you in advance!
>  >>
>  >>
>  >>  Here is the code I am using:
>  >>
>  >>  public class Start
>  >>  {
>  >>         private Generic<Test> genericsTest = new Generic<Test>(new
>  >> Test(555));
>  >>         public Generic<Test> getGenericsTest() {return genericsTest;}
>  >>         public void setGenericsTest(Generic<Test> test)
>  >> {this.genericsTest=test;}
>  >>  }
>  >>
>  >>
>  >>  public class Generic<T> {
>  >>         T instance;
>  >>
>  >>         public Generic(T instance)
>  >>         {
>  >>                 this.instance=instance;
>  >>         }
>  >>
>  >>         public T getInstance() {return instance;}
>  >>         public void setInstance(T instance) {this.instance = instance;}
>  >>  }
>  >>
>  >>
>  >>  public class Test
>  >>  {
>  >>         int id;
>  >>         public Test(int id)
>  >>         {
>  >>                 this.id = id;
>  >>         }
>  >>         public int getId() {return id;}
>  >>         public void setId(int id) {this.id = id;}
>  >>  }
>  >>
>  >>  Start.tml:
>  >>
>  >>          Java 1.5 Generics Test: ${genericsTest.instance.id}
>  >>
>  >>
>  >>
>  >>  --
>  >>  View this message in context:
>  >> http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15885528.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 Apache Tapestry and Apache HiveMind
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  > For additional commands, e-mail: users-help@tapestry.apache.org
>  >
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15909013.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 Apache Tapestry and Apache HiveMind

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


Re: [T5] Help getting generics to work

Posted by buckofive <kl...@yahoo.com>.
Howard,

Thank you for the quick response!  Are there intentions to get Tapestry to
support generics for cases like this when its released?  It would really be
great to have this kind of support (I've already come across a few cases
where it would come in very handy).

Thanks again,
B



Howard Lewis Ship wrote:
> 
> Tapestry only understands simple generics applied directly to your
> page or component class.
> 
> On Thu, Mar 6, 2008 at 4:59 PM, buckofive <kl...@yahoo.com> wrote:
>>
>>
>>  Hi all,
>>
>>  I'm wondering if this is even possible.   I read that java 1.5 generics
>>  support was as added as of tapestry 5.0.10 but I am unable to get it to
>>  work.  I always end up with this exception:
>>  "Class java.lang.Object does not contain a property named 'id' (within
>>  property expression 'genericsTest.instance.id').  Available properties:
>>  class."
>>
>>  I have tried this with 5.0.10 and 5.0.11-SNAPSHOT.  I would greatly
>>  appreciate any help, I'm sure its something silly that I'm missing.
>>
>>  Thank you in advance!
>>
>>
>>  Here is the code I am using:
>>
>>  public class Start
>>  {
>>         private Generic<Test> genericsTest = new Generic<Test>(new
>> Test(555));
>>         public Generic<Test> getGenericsTest() {return genericsTest;}
>>         public void setGenericsTest(Generic<Test> test)
>> {this.genericsTest=test;}
>>  }
>>
>>
>>  public class Generic<T> {
>>         T instance;
>>
>>         public Generic(T instance)
>>         {
>>                 this.instance=instance;
>>         }
>>
>>         public T getInstance() {return instance;}
>>         public void setInstance(T instance) {this.instance = instance;}
>>  }
>>
>>
>>  public class Test
>>  {
>>         int id;
>>         public Test(int id)
>>         {
>>                 this.id = id;
>>         }
>>         public int getId() {return id;}
>>         public void setId(int id) {this.id = id;}
>>  }
>>
>>  Start.tml:
>>
>>          Java 1.5 Generics Test: ${genericsTest.instance.id}
>>
>>
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15885528.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 Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15909013.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: [T5] Help getting generics to work

Posted by Howard Lewis Ship <hl...@gmail.com>.
Tapestry only understands simple generics applied directly to your
page or component class.

On Thu, Mar 6, 2008 at 4:59 PM, buckofive <kl...@yahoo.com> wrote:
>
>
>  Hi all,
>
>  I'm wondering if this is even possible.   I read that java 1.5 generics
>  support was as added as of tapestry 5.0.10 but I am unable to get it to
>  work.  I always end up with this exception:
>  "Class java.lang.Object does not contain a property named 'id' (within
>  property expression 'genericsTest.instance.id').  Available properties:
>  class."
>
>  I have tried this with 5.0.10 and 5.0.11-SNAPSHOT.  I would greatly
>  appreciate any help, I'm sure its something silly that I'm missing.
>
>  Thank you in advance!
>
>
>  Here is the code I am using:
>
>  public class Start
>  {
>         private Generic<Test> genericsTest = new Generic<Test>(new Test(555));
>         public Generic<Test> getGenericsTest() {return genericsTest;}
>         public void setGenericsTest(Generic<Test> test) {this.genericsTest=test;}
>  }
>
>
>  public class Generic<T> {
>         T instance;
>
>         public Generic(T instance)
>         {
>                 this.instance=instance;
>         }
>
>         public T getInstance() {return instance;}
>         public void setInstance(T instance) {this.instance = instance;}
>  }
>
>
>  public class Test
>  {
>         int id;
>         public Test(int id)
>         {
>                 this.id = id;
>         }
>         public int getId() {return id;}
>         public void setId(int id) {this.id = id;}
>  }
>
>  Start.tml:
>
>          Java 1.5 Generics Test: ${genericsTest.instance.id}
>
>
>
>  --
>  View this message in context: http://www.nabble.com/-T5--Help-getting-generics-to-work-tp15885528p15885528.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 Apache Tapestry and Apache HiveMind

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