Fragments

Composites should be perceived as single units, although they consist of many Java classes and instances. Some of those Java instances are not even belonging to a particular instance in runtime, but such details can and should be ignored by the developer. Developers should think of the Composite as a single concept, and not be concerned about its internal structure.

The Composite is composed by declaring the parts it forms in the Composite Type interface declaration. Technically speaking, Composite Type is the only Fragment that is required to exist. The other Fragments are optional.

There are one very important thing to know about Fragments;

ONLY Mixins can maintain inter-method state.

That means that Concerns, Constraints and Side Effects can not assume that Java fields between method invocations are preserved. These Fragments must rely on either Mixins or external services for additional state.


Qi4j and the Qi4j logo are trademarks of Richard Öberg, Niclas Hedhman and the members of the Qi4j Core Team. See Qi4j licensing for more information.
Powered by SiteVisionexternal link.