org.jvnet.hk2.config
Annotation Type Configured


@Contract
@Retention(value=RUNTIME)
@Target(value=TYPE)
@Inherited
public @interface Configured

Marks inhabitants that require configuration for instantiation.

Author:
Kohsuke Kawaguchi

Optional Element Summary
 boolean local
          Designates the configuration element as local element.
 String name
          XML element name that this configured object maps to.
 Class[] symbolSpace
          Designates that a configured component creates a new symbol space for given kinds of children.
 

name

public abstract String name
XML element name that this configured object maps to. See Attribute.value() for how the default value is inferred.

See Also:
local()
Default:
""

local

public abstract boolean local
Designates the configuration element as local element.

By default, element names for configured inhabitant are global, meaning component can be referenced from anywhere that allow a valid substitution, such as:

 @Element("*")
 List<Object> any;
 

Setting this flag to true will prevent this, and instead make this element local. Such configuration inhabitants will not have any associated element name, and therefore can only participate in the configuration XML when explicitly referenced from its parent. For example:

 @Configured
 class Foo {
   @Element List<Property> properties;
 }

 @Configured(local=true)
 class Property {
   @FromAttribute String name;
   @FromAttribute String value;
 }

 <foo>
   <property name="aaa" value="bbb" />
 </foo>
 

This switch is mutually exclusive with name().

Default:
false

symbolSpace

public abstract Class[] symbolSpace
Designates that a configured component creates a new symbol space for given kinds of children.

Default:
{}


Copyright © 2012 Oracle Corporation. All Rights Reserved.