Covalent

A lightweight Java component model and runtime container.

View the Project on GitHub opales-org/covalent

Home | Previous: Rubik’s Cube Solver - Architecture | Next: Covalent Configuration Reference

Table of Contents

Every annotation of the Covalent component model on one page. For each one, the table gives where it goes and what it means; follow the link for the full explanation. For a plain-language definition of the underlying concept, see the Glossary.

Component Structure

Annotation Placed on Meaning Reference
@Component interface declares a component type (an empty tag interface) Component Type
@Implementation class; field of a composite declares the implementation class of a component, or a sub-component field in a composite Implementation, Composition
@Item class; field declares a component item class, or the field that holds it Items
@ComponentItem see Items alternative to @Item on the field that aggregates an item Items
@ComposedComponent field alternative to @Implementation on the field that owns a sub-component Composition

Services, Parameters And Events

Annotation Placed on Meaning Reference
@Services interface; field declares a services interface; on a field, same as @UsedServices Services
@UsedServices field the component uses these services; the container injects the provider Using Services
@Parameters interface; field declares a parameters interface; on a field, same as @AccessedParameters Parameters
@AccessedParameters field the component accesses these parameters; the container injects them Accessing Parameters
@Events interface; field declares an events interface; on a field, same as @ProducedEvents Events
@ProducedEvents field the component produces these events Producing Events
@EventsSubscribe interface nested in an events interface declares the subscribe interface of the events Event Subscription
@UsedEventsSubscribe field the component subscribes manually, through a subscribe interface Event Subscription
@EventsFilter interface nested in an events interface declares the filter interface of the events Event Filters
@Cloned events interface; event method; event method argument clones the event arguments before delivery Event Data Cloning

Lifecycle Callbacks

These annotations go on a method of the implementation, which must take no argument. Each one is equivalent to implementing the interface in the second column.

Annotation Equivalent interface Called Reference
@Initialization Initializable once, when the component is initialized Lifecycle Callbacks
@Activation Activable each time the component is activated Lifecycle Callbacks
@Passivation Passivatable each time the component is passivated Lifecycle Callbacks
@Removal Removable once, when the component is removed Lifecycle Callbacks

ComponentLifecycleTransition declares the four callbacks in a single interface.

Infrastructure

Annotation Placed on Meaning Reference
@Internal class marks a component of the container itself, as opposed to an application component; reserved to Covalent, refused on application components Starting a Covalent Application

Where Each Annotation Lives

Naming Conventions

Covalent recommends naming conventions for the elements it injects and calls. They are optional, unless structural rule verification is set to its strictest level; each kind can also be disabled individually. See Verification Level.

Element Convention Example
services interface ends with Services PricingServices
used services field use + services interface name usePricingServices
parameters interface ends with Parameters PricingParameters
accessed parameters field access + parameters interface name accessPricingParameters
events interface ends with Events OrderEvents
event method on + past-tense verb onOrderPlaced
produced events field produce + events interface name produceOrderEvents
events subscribe interface ends with Subscribe (mandatory) OrderEventsSubscribe
used events subscribe field use + subscribe interface name useOrderEventsSubscribe
filter interface events interface name + Filter (mandatory for managed components) OrderEventsFilter
filter method event method name with on replaced by filter (mandatory) filterOrderPlaced
subscribe and unsubscribe methods prefixed with subscribe and unsubscribe (mandatory) subscribe(observer)

Home | Previous: Rubik’s Cube Solver - Architecture | Next: Covalent Configuration Reference