in src/main/java/org/apache/sling/feature/resolver/impl/FeatureResourceImpl.java [41:74]
public FeatureResourceImpl(Feature f) {
artifact = new Artifact(f.getId());
feature = f;
capabilities = new HashMap<>();
for (Capability r : f.getCapabilities()) {
List<Capability> l = capabilities.get(r.getNamespace());
if (l == null) {
l = new ArrayList<>();
capabilities.put(r.getNamespace(), l);
}
l.add(new CapabilityImpl(this, r));
}
// Add the identity capability
Map<String, Object> idattrs = new HashMap<>();
idattrs.put(IdentityNamespace.IDENTITY_NAMESPACE, getId());
idattrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, "sling.feature");
idattrs.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, getVersion());
idattrs.put(IdentityNamespace.CAPABILITY_DESCRIPTION_ATTRIBUTE, f.getDescription());
idattrs.put(IdentityNamespace.CAPABILITY_LICENSE_ATTRIBUTE, f.getLicense());
Capability idCap = new CapabilityImpl(this, IdentityNamespace.IDENTITY_NAMESPACE, null, idattrs);
capabilities.put(IdentityNamespace.IDENTITY_NAMESPACE, Collections.singletonList(idCap));
requirements = new HashMap<>();
for (Requirement r : f.getRequirements()) {
List<Requirement> l = requirements.get(r.getNamespace());
if (l == null) {
l = new ArrayList<>();
requirements.put(r.getNamespace(), l);
}
l.add(new RequirementImpl(this, r));
}
}