Well by adding this to my module :

        public static void bind(ServiceBinder binder){
                binder.bind(User.class, UserImpl.class);
                binder.bind(Address.class, AddressImpl.class);
        }

I solved the User instanciation problem. But It didn't solve the Address
instanciation problem.

In fact User model have an Address property. I want to user BeanEditForm to
Edit both the User and is Address. This is the component :

<t:beanEditForm t:object="user">
         <t:parameter name="address">
                <fieldset>
                        <legend>Address</legend>  
                        <t:beanEditor object="user.address" />
                </fieldset>
         </t:parameter>
</t:beanEditForm>       

I set this in the AppModule for my address field can be detected by the
BeanEditor :

public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class<?>, String>
configuration) {
          configuration.add(Address.class, "address");
}

And I stiil have the InstantiationException. If I make direct reference to
the implementation classes that works fine (but I don't want to do it that
way).

I tried configuration.add(AddressImpl.class, "address"); but it does not
work at all because tapestru can't detect the Address field in User bean.

Any ideas ?

Regards,

Martin




Sven Homburg wrote:
> 
> this should help you
> http://wiki.apache.org/tapestry/Tapestry5HowToIocAndHibernate
> 
> 2008/2/3, Kheldar666 <[EMAIL PROTECTED]>:
>>
>> Hi Everybody,
>>
>> I was wondering if ASO and BeanEditor can work with Interfaces ? At the
>> first sight it seems not possible.
>>
>> Let's say I have this Interface and Classes :
>>
>> public interface User {
>>         public int getId();
>>         public void setId(int id);
>>         public String getName();
>>         public void setName(String name);
>> }
>>
>> public class UserImpl implements User {
>>         //An implementation with Hibernate annotation for instance
>> }
>>
>> Everywhere in Tapestry we use Interfaces for the IoC. But if I declare
>> somewhere :
>>
>>
>> @ApplicationState
>> private User _user
>>
>>
>> I have an InstanciationException (witch is normal, because Tapestry have
>> no
>> way to guess that it should instanciate UserImpl and it tries to
>> instanciate
>> an Interface).
>>
>> So my question is : is there a way to tell Tapestry to instanciate the
>> right
>> class and not the Interface (may be via contributing to some Service
>> configuration or something ) ? Or should I wrote a simple data object
>> that
>> can be directly instanciated and some kind of translator that would
>> convert
>> my Data Object into the class used by my internal services ?
>> --
>> View this message in context:
>> http://www.nabble.com/-T5--ASO%2C-BeanEditor-and-Interfaces-tp15254725p15254725.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> with regards
> Sven Homburg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -----
> best regards
> Sven
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--ASO%2C-BeanEditor-and-Interfaces-tp15254725p15255319.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to