use of org.qi4j.tools.model.descriptor.ObjectDetailDescriptor 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);
}
}
}
}
use of org.qi4j.tools.model.descriptor.ObjectDetailDescriptor in project qi4j-sdk by Qi4j.
the class ServiceConfigurationPane method setDescriptor.
@Override
protected void setDescriptor(Object objectDesciptor) {
clear();
if (!(objectDesciptor instanceof ServiceDetailDescriptor)) {
return;
}
configDescriptor = DescriptorUtilities.findServiceConfiguration((ServiceDetailDescriptor) objectDesciptor);
if (configDescriptor == null) {
return;
}
ModelDescriptor spiDescriptor = null;
String typeString = null;
if (configDescriptor instanceof ServiceDetailDescriptor) {
spiDescriptor = ((ServiceDetailDescriptor) configDescriptor).descriptor();
typeString = "Service";
} else if (configDescriptor instanceof EntityDetailDescriptor) {
spiDescriptor = ((EntityDetailDescriptor) configDescriptor).descriptor();
typeString = "Entity";
} else if (configDescriptor instanceof ValueDetailDescriptor) {
spiDescriptor = ((ValueDetailDescriptor) configDescriptor).descriptor();
typeString = "Value";
} else if (configDescriptor instanceof ObjectDetailDescriptor) {
spiDescriptor = ((ObjectDetailDescriptor) configDescriptor).descriptor();
typeString = "Object";
} else if (configDescriptor instanceof CompositeDetailDescriptor) {
spiDescriptor = ((ObjectDetailDescriptor) configDescriptor).descriptor();
typeString = "Transient";
}
Class<?> type = first(spiDescriptor.types());
String simpleName = type.getSimpleName();
nameLabel.setText("<html><a href='" + simpleName + "'>" + simpleName + "</a></html>");
classLabel.setText(type.getName());
typeLabel.setText(typeString);
linkButton.setEnabled(true);
}
use of org.qi4j.tools.model.descriptor.ObjectDetailDescriptor in project qi4j-sdk by Qi4j.
the class StatePane method setDescriptor.
@Override
protected void setDescriptor(Object objectDesciptor) {
clear();
if (objectDesciptor instanceof CompositeDetailDescriptor) {
CompositeDetailDescriptor descriptor = ((CompositeDetailDescriptor) objectDesciptor);
List<CompositeMethodDetailDescriptor> list = DescriptorUtilities.findState(descriptor);
for (CompositeMethodDetailDescriptor methodDescriptor : list) {
methodListModel.addElement(methodDescriptor);
}
if (!methodListModel.isEmpty()) {
methodList.setSelectedIndex(0);
}
} else if (objectDesciptor instanceof ObjectDetailDescriptor) {
// Object does not have state
}
}
Aggregations