use of org.apache.felix.scr.impl.inject.methods.ModifiedMethod in project felix by apache.
the class ComponentMethodsImpl method initComponentMethods.
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public synchronized void initComponentMethods(final ComponentMetadata componentMetadata, final Class<T> implementationObjectClass, final ComponentLogger logger) {
if (m_activateMethod != null) {
// do init only once
return;
}
DSVersion dsVersion = componentMetadata.getDSVersion();
boolean configurableServiceProperties = componentMetadata.isConfigurableServiceProperties();
boolean supportsInterfaces = componentMetadata.isConfigureWithInterfaces();
m_activateMethod = new ActivateMethod(componentMetadata.getActivate(), componentMetadata.isActivateDeclared(), implementationObjectClass, dsVersion, configurableServiceProperties, supportsInterfaces);
m_deactivateMethod = new DeactivateMethod(componentMetadata.getDeactivate(), componentMetadata.isDeactivateDeclared(), implementationObjectClass, dsVersion, configurableServiceProperties, supportsInterfaces);
m_modifiedMethod = new ModifiedMethod(componentMetadata.getModified(), implementationObjectClass, dsVersion, configurableServiceProperties, supportsInterfaces);
for (ReferenceMetadata referenceMetadata : componentMetadata.getDependencies()) {
final String refName = referenceMetadata.getName();
final List<ReferenceMethods> methods = new ArrayList<>();
if (referenceMetadata.getField() != null) {
methods.add(new FieldMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties));
}
if (referenceMetadata.getBind() != null) {
methods.add(new BindMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties));
}
if (methods.isEmpty()) {
bindMethodMap.put(refName, ReferenceMethods.NOPReferenceMethod);
} else if (methods.size() == 1) {
bindMethodMap.put(refName, methods.get(0));
} else {
bindMethodMap.put(refName, new DuplexReferenceMethods(methods));
}
}
m_constructor = new ComponentConstructor(componentMetadata, implementationObjectClass, logger);
}
Aggregations