On 19 Jan 2016 at 11:24:46, Thomas Mortagne
(thomas.mortagne@xwiki.com(mailto:thomas.mortagne@xwiki.com)) wrote:
If this class is supposed to be available in the wiki
even if not yet
used in an object the simplest is usually to do like most standard
classes generated from java and register a component extending
com.xpn.xwiki.internal.mandatory.AbstractMandatoryDocumentInitializer.
You can find various examples in oldcore.
Yes conceptually speaking, the idea is to write an EventListener component that listens to
the ApplicationReadyEvent event and then in the onEvent() method, create your xclass and
perform all the operations you need.
As Thomas mentioned, you could also extend AbstractMandatoryDocumentInitializer although
this is not a public API and it may be removed or modified in the future. Note that
MandatoryDocumentInitializer is a public API.
Thanks
-Vincent
On Tue, Jan 19, 2016 at 11:18 AM, Giordano Ninonà
wrote:
> Hi users,
>
> I am wondering on how to create an XClass from java, and bind it to a
> class-sheet to be used to represent several objects as XWiki pages. How can
> I achieve that in a way that allow me to incrementaly update the object
> every time a modification is performed?
>
> Thanks for your help,
> Giordano.