Wiki source code of XWiki Classes
Last modified by Eleni Cojocariu on 2026/03/19 08:10
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | An XWiki Class is like a template that defines a unique type of [[XWiki Object>>xwiki:documentation.xs.dev.data-model.x-objects.WebHome]]. It specifies what [[XWiki Properties (Data Types)>>xwiki:documentation.xs.dev.data-model.x-properties.WebHome]] an Object can have, and ensures that all Objects created from this Class follow the same structure. When you define a custom Class, you are preparing your application to create one or many Objects (instances) of that Class. | ||
| 2 | |||
| 3 | An analogy is the cookie cutter: | ||
| 4 | |||
| 5 | * The Class is the cookie cutter: it defines the shape and rules. | ||
| 6 | * The Objects are the cookies: each one is an individual instance created from the cutter. (And in this case, we’re talking about real, edible cookies, not Web cookies). | ||
| 7 | |||
| 8 | Each Class is attached to a Page: | ||
| 9 | |||
| 10 | * There can be at most one Class per Page. | ||
| 11 | * The Class name is the same as the name of the Page it is attached to. | ||
| 12 | |||
| 13 | In short, a Class in XWiki acts like a schema: it doesn’t hold data itself, but it defines the structure and Properties that all its Objects will share. |