org.qi4j.api.common
Class MetaInfo
java.lang.Object
org.qi4j.api.common.MetaInfo
public final class MetaInfo
- extends java.lang.Object
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 );
}
}
Method Summary |
|
add(java.lang.Class<T> infoType,
T info)
|
|
get(java.lang.Class<T> metaInfoType)
|
void |
remove(java.lang.Class serviceFinderClass)
|
void |
set(java.lang.Object metaInfo)
|
java.lang.String |
toString()
|
MetaInfo |
withAnnotations(java.lang.reflect.AnnotatedElement annotatedElement)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MetaInfo
public MetaInfo()
MetaInfo
public MetaInfo(MetaInfo metaInfo)
set
public void set(java.lang.Object metaInfo)
get
public <T> T get(java.lang.Class<T> metaInfoType)
add
public <T> void add(java.lang.Class<T> infoType,
T info)
withAnnotations
public MetaInfo withAnnotations(java.lang.reflect.AnnotatedElement annotatedElement)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
remove
public void remove(java.lang.Class serviceFinderClass)