Search in sources :

Example 1 with MixinDetailDescriptor

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

the class TableRowUtilities method toTableRows.

public static List<TableRow> toTableRows(List<ServiceUsage> serviceUsages) {
    List<TableRow> rows = new ArrayList<>();
    for (ServiceUsage usage : serviceUsages) {
        TableRow row = new TableRow(5);
        if (usage.ownerDescriptor() instanceof MixinDetailDescriptor) {
            MixinDetailDescriptor mixinDescriptor = (MixinDetailDescriptor) usage.ownerDescriptor();
            row.set(0, mixinDescriptor.composite());
            row.set(1, usage.field());
            row.set(2, mixinDescriptor.composite().module());
            row.set(3, mixinDescriptor.composite().module().layer());
        } else {
            // assume ObjectDetailDescriptor
            ObjectDetailDescriptor objectDescriptor = (ObjectDetailDescriptor) usage.ownerDescriptor();
            row.set(0, objectDescriptor);
            row.set(1, usage.field());
            row.set(2, objectDescriptor.module());
            row.set(3, objectDescriptor.module().layer());
        }
        rows.add(row);
    }
    return rows;
}
Also used : MixinDetailDescriptor(org.qi4j.tools.model.descriptor.MixinDetailDescriptor) ArrayList(java.util.ArrayList) ServiceUsage(org.qi4j.tools.model.descriptor.ServiceUsage) ObjectDetailDescriptor(org.qi4j.tools.model.descriptor.ObjectDetailDescriptor)

Example 2 with MixinDetailDescriptor

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

the class DependencyPane method setDescriptor.

@Override
protected void setDescriptor(Object objectDesciptor) {
    clear();
    if (objectDesciptor instanceof CompositeDetailDescriptor) {
        CompositeDetailDescriptor descriptor = ((CompositeDetailDescriptor) objectDesciptor);
        Iterable<MixinDetailDescriptor> iter = descriptor.mixins();
        for (MixinDetailDescriptor mixinDescriptor : iter) {
            reload(mixinDescriptor.injectedFields());
        }
    } else if (objectDesciptor instanceof ObjectDetailDescriptor) {
        ObjectDetailDescriptor descriptor = ((ObjectDetailDescriptor) objectDesciptor);
        reload(descriptor.injectedFields());
    }
    if (!fieldListModel.isEmpty()) {
        fieldList.setSelectedIndex(0);
    }
}
Also used : MixinDetailDescriptor(org.qi4j.tools.model.descriptor.MixinDetailDescriptor) ObjectDetailDescriptor(org.qi4j.tools.model.descriptor.ObjectDetailDescriptor) CompositeDetailDescriptor(org.qi4j.tools.model.descriptor.CompositeDetailDescriptor)

Example 3 with MixinDetailDescriptor

use of org.qi4j.tools.model.descriptor.MixinDetailDescriptor 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

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