Context DescriptorDescriptionThe org.apache.avalon.meta.info.ContextDescriptor class describes the set of context entries that a component may be depedent on. Context entries declare a context key and the classname of the value that the component expects to receive. A compliant container will ensure that a context object supplied to a component under the Contextualize phase can access required context entries with assurance that the value will be supplied under the correct key as as an instance of the required type. The supply of optional context entries is a container concern with the single exception that a container must ensure that the an optional entry corresponds to the type requested by the component context entry. Attributes
Nested Elements
Example XML<!-- Declaration of the context constraints for the compoent type. The "type" attribute is the name of an interface derived from the default contenxt interface org.apache.avalon.framework.context.Context --> <context type="MyContextInterface"> <!-- Declaration of an entry in a context object, the "key" is the key used by a component to locate the context entry, the "type" is the classname of value (typically an interface) or primative type. The default value is java.lang.String. The "optional" attribute is a boolean value derived from the TRUE or FALSE that indicates if the context value must be provided or not (default is FALSE). --> <entry key="base" type="java.io.File"/> <entry key="mode" optional="TRUE"/> </context> |