Search in sources :

Example 1 with FieldMethods

use of org.apache.felix.scr.impl.inject.FieldMethods in project felix by apache.

the class ComponentMethodsImpl method initComponentMethods.

public synchronized void initComponentMethods(ComponentMetadata componentMetadata, Class<?> implementationObjectClass) {
    if (m_activateMethod != null) {
        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 ReferenceMethods methods;
        if (referenceMetadata.getField() != null && referenceMetadata.getBind() != null) {
            methods = new DuplexReferenceMethods(new FieldMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties), new BindMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties));
        } else if (referenceMetadata.getField() != null) {
            methods = new FieldMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties);
        } else {
            methods = new BindMethods(referenceMetadata, implementationObjectClass, dsVersion, configurableServiceProperties);
        }
        bindMethodMap.put(refName, methods);
    }
}
Also used : DuplexReferenceMethods(org.apache.felix.scr.impl.inject.DuplexReferenceMethods) FieldMethods(org.apache.felix.scr.impl.inject.FieldMethods) DeactivateMethod(org.apache.felix.scr.impl.inject.DeactivateMethod) DSVersion(org.apache.felix.scr.impl.metadata.DSVersion) ModifiedMethod(org.apache.felix.scr.impl.inject.ModifiedMethod) BindMethods(org.apache.felix.scr.impl.inject.BindMethods) ActivateMethod(org.apache.felix.scr.impl.inject.ActivateMethod) ReferenceMetadata(org.apache.felix.scr.impl.metadata.ReferenceMetadata) DuplexReferenceMethods(org.apache.felix.scr.impl.inject.DuplexReferenceMethods) ReferenceMethods(org.apache.felix.scr.impl.helper.ReferenceMethods)

Aggregations

ReferenceMethods (org.apache.felix.scr.impl.helper.ReferenceMethods)1 ActivateMethod (org.apache.felix.scr.impl.inject.ActivateMethod)1 BindMethods (org.apache.felix.scr.impl.inject.BindMethods)1 DeactivateMethod (org.apache.felix.scr.impl.inject.DeactivateMethod)1 DuplexReferenceMethods (org.apache.felix.scr.impl.inject.DuplexReferenceMethods)1 FieldMethods (org.apache.felix.scr.impl.inject.FieldMethods)1 ModifiedMethod (org.apache.felix.scr.impl.inject.ModifiedMethod)1 DSVersion (org.apache.felix.scr.impl.metadata.DSVersion)1 ReferenceMetadata (org.apache.felix.scr.impl.metadata.ReferenceMetadata)1