org.qi4j.api.common
Class MetaInfo
java.lang.Object
org.qi4j.api.common.MetaInfo
- All Implemented Interfaces:
- Serializable
public final class MetaInfo
- extends Object
- implements Serializable
Used to declare and access meta-info.
This is effectively an internal class and should not be used directly.
MetaInfo can be set on composites during the assembly phase, a.k.a the bootstrap
process. MetaInfo is any additional data that one wishes to associate at the 'class level' instead of instance
level of a composite declaration.
To set the MetaInfo on a Composite, call the setMetaInfo()
methods on the various composite declaration
types, such as;
public void assemble( ModuleAssembly module )
throws AssemblyException
{
Map properties = ...;
module.services( MyService.class ).setMetaInfo( properties );
}
which can later be retrieved by calling the metaInfo()
method on the composite itself. For the example
above that would be;
@Mixins(MyServiceMixin.class)
public interface MyService extends ServiceComposite
{
}
public abstract class MyServiceMixin
implements MyService
{
private Properties props;
public MyServiceMixin()
{
props = metaInfo( Map.class );
}
}
- See Also:
- Serialized Form
MetaInfo
public MetaInfo()
MetaInfo
public MetaInfo(MetaInfo metaInfo)
set
public void set(Object metaInfo)
get
public <T> T get(Class<T> metaInfoType)
add
public <T> void add(Class<T> infoType,
T info)
withAnnotations
public MetaInfo withAnnotations(AnnotatedElement annotatedElement)
toString
public String toString()
- Overrides:
toString
in class Object
remove
public void remove(Class serviceFinderClass)