Search in sources :

Example 1 with InjectedFieldDetailDescriptor

use of org.qi4j.tools.model.descriptor.InjectedFieldDetailDescriptor in project qi4j-sdk by Qi4j.

the class DependencyPane method reload.

private void reload(Iterable<InjectedFieldDetailDescriptor> iter) {
    for (InjectedFieldDetailDescriptor descriptor : iter) {
        DependencyDescriptor dependencyDescriptor = descriptor.descriptor().dependency();
        Annotation annotation = dependencyDescriptor.injectionAnnotation();
        if (isDependencyField(annotation.annotationType())) {
            fieldListModel.addElement(descriptor);
        }
    }
}
Also used : InjectedFieldDetailDescriptor(org.qi4j.tools.model.descriptor.InjectedFieldDetailDescriptor) DependencyDescriptor(org.qi4j.api.composite.DependencyDescriptor) Annotation(java.lang.annotation.Annotation)

Example 2 with InjectedFieldDetailDescriptor

use of org.qi4j.tools.model.descriptor.InjectedFieldDetailDescriptor in project qi4j-sdk by Qi4j.

the class ServiceUsageFinder method collectInInjectedField.

private void collectInInjectedField(Iterable<InjectedFieldDetailDescriptor> iter, Object ownerDescriptor) {
    for (InjectedFieldDetailDescriptor descriptorField : iter) {
        DependencyDescriptor dependencyDescriptor = descriptorField.descriptor().dependency();
        Annotation annotation = dependencyDescriptor.injectionAnnotation();
        Class<? extends Annotation> clazz = annotation.annotationType();
        if (Uses.class.equals(clazz) || Service.class.equals(clazz)) {
            boolean used = false;
            if (dependencyDescriptor.injectionType().equals(first(this.descriptor.descriptor().types()))) {
                ServiceUsage usage;
                if (ownerDescriptor instanceof MixinDetailDescriptor) {
                    MixinDetailDescriptor mixinDescriptor = (MixinDetailDescriptor) ownerDescriptor;
                    usage = new ServiceUsage(mixinDescriptor.composite(), descriptorField, mixinDescriptor.composite().module(), mixinDescriptor.composite().module().layer());
                } else {
                    // assume ObjectDetailDescriptor
                    ObjectDetailDescriptor objectDescriptor = (ObjectDetailDescriptor) ownerDescriptor;
                    usage = new ServiceUsage(objectDescriptor, descriptorField, objectDescriptor.module(), objectDescriptor.module().layer());
                }
                usages.add(usage);
            }
        }
    }
}
Also used : Uses(org.qi4j.api.injection.scope.Uses) InjectedFieldDetailDescriptor(org.qi4j.tools.model.descriptor.InjectedFieldDetailDescriptor) DependencyDescriptor(org.qi4j.api.composite.DependencyDescriptor) MixinDetailDescriptor(org.qi4j.tools.model.descriptor.MixinDetailDescriptor) ServiceUsage(org.qi4j.tools.model.descriptor.ServiceUsage) Service(org.qi4j.api.injection.scope.Service) ObjectDetailDescriptor(org.qi4j.tools.model.descriptor.ObjectDetailDescriptor) Annotation(java.lang.annotation.Annotation)

Aggregations

Annotation (java.lang.annotation.Annotation)2 DependencyDescriptor (org.qi4j.api.composite.DependencyDescriptor)2 InjectedFieldDetailDescriptor (org.qi4j.tools.model.descriptor.InjectedFieldDetailDescriptor)2 Service (org.qi4j.api.injection.scope.Service)1 Uses (org.qi4j.api.injection.scope.Uses)1 MixinDetailDescriptor (org.qi4j.tools.model.descriptor.MixinDetailDescriptor)1 ObjectDetailDescriptor (org.qi4j.tools.model.descriptor.ObjectDetailDescriptor)1 ServiceUsage (org.qi4j.tools.model.descriptor.ServiceUsage)1