return this;
}
@Override
public CapabilityFactory get(final CapabilityType type) {
CapabilityFactory factory = factories.get(checkNotNull(type).toString());
if (factory == null) {
factory = dynamicFactories.get(checkNotNull(type).toString());
}
if (factory == null) {
final CapabilityDescriptor descriptor = capabilityDescriptorRegistry.get(type);
if (descriptor != null && descriptor instanceof CapabilityFactory) {
factory = (CapabilityFactory) descriptor;
}
if (factory == null) {
try {
final Iterable<? extends BeanEntry<?, Capability>> entries = beanLocator.locate(
Key.get(Capability.class, named(type.toString()))
);
if (entries != null && entries.iterator().hasNext()) {
factory = new CapabilityFactory()
{
@Override
public Capability create() {
return entries.iterator().next().getValue();
}