> Hi,
> I would like to create a class "Contact" with a property " 
> PersonalAddress". As I guess that  will have to reuse the concept of 
> Address to manage other things , I decide to create first a class 
> "Address" and then I would like to assign this type to the property 
> "PersonalAddress" of the class "Contact" as one would do in OO Languages 
> like Java ; but it doesn't seem possible or did I miss something?
> Thank you
> BenoƮt


This is not possible. Classes in XWiki can have fields only of 
predefined, simple data types. Usually, the strategy to do what you want 
is like this:

1. Create the Address class, also adding an "address type" field.
2. In a document, use one Contact object and several Address objects.

This way you gain even more flexibility. You can either use one Address 
object with "type" = "personal" and one with "type" = "work" (or 
whatever values you like), or you can accept any number of objects, and 
the user can select what type of address he wants, and a button "add 
address" allows him to add a new Address object.
Sergiu Dumitriu
users mailing list

Reply via email to