Hi Martin,
thanks for the hint.
> 
> protected Class<T> getValueClass()
> {
>       return (Class<T>) ((ParameterizedType)
> getClass().getGenericSuperclass()).getActualTypeArguments()[0];
> }
> 
> 
> I use something similar in DAOs, idea came from here:
> https://www.hibernate.org/328.html

Similar to the example you provided, I have erased the method and use a field 
now. This way the value's class needn't be calculated several times but only 
once at page instanciation.
        /**
         * the value's class in the implementing page
         */
        @SuppressWarnings("unchecked")
        private final Class<T> classOfValue = (Class<T>) ((ParameterizedType) 
this
                        
.getClass().getGenericSuperclass()).getActualTypeArguments()[0];

Regards, nillehammer

==
http://www.winfonet.eu

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

Reply via email to