It is safe to use same classes from same modules in different layers

PavelTurk pavelturk2000 at gmail.com
Sun Sep 8 07:59:57 UTC 2024


Hello everyone,

Lets consider the following situation:

Bootlayer (module Core) is a main application
- child layer A (module A, module Foo) is a plugin A
- child layer B (module B, module Foo) is a plugin B.

So, the SAME module Foo (with class Foo) is used in two different child layers.

Module Core provides this service {
        Object getInterPluginObject();
        void setInterPluginObject(Object obj);
}

So, in plugin A I do
var foo = new Foo();
coreService.setInterPluginObject(foo);

and in plugin B I do
var foo = (Foo) coreService.getInterPluginObject();

Could anyone say if it should work, and if yes, then how safe this approach is?
Please note, that module Foo CAN NOT be added to bootlayer because main
application shouldn't know anything about it.

The reason of this question is that I try to find the best solution for inter plugin
work where every plugin is a child layer of the bootlayer. Maybe there are other
ways to do it?

Best regards, Pavel



More information about the jigsaw-dev mailing list