link
Avalon
Javadoc Tag Specification
Home PlanetProductsCentral
Javadoc Tags
Component Tag

The component tag declares a java source as a component type. The tag is a required when generating a component type descriptor.

Attributes
AttributeRequiredDescription
nameyes

The name representing the component type.

versionno

The version used for this component implementation. If not supplied a default version of 1.0 is assumed.

lifestyleno

The lifestyle that the component was designed for. The lifestyle may be one of four predefined values. A compliant container is not required to provide equivalent lifestyle support, however, a container is required to recognize and reject a component that it cannot support.

If not declared, a container may assume the transient lifestyle.

Recognized lifestyle attribute values include:

  • singleton - an instance may be shared between multiple clients
  • thread - one instance per thread
  • transient - new instance are created on demand
Example
package org.apache.avalon.playground;

/**
 * Example of the declaration of named component type.
 *
 * @avalon.component version="1.0" name="sample" lifestyle="singleton"
 */
public class DefaultComponent
{
  ...
}

Generated meta-info type descriptor:

<type>
  <info>
    <version>1.0.0</version>
    <name>sample</name>
    <lifestyle>singleton</lifestyle>
  </info>
</type>