2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.blueprint.ext;
10 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
11 import org.osgi.service.blueprint.container.Converter;
12 import org.osgi.service.blueprint.container.ReifiedType;
15 * Implements a Converter that converts RoutedRpcRegistration instances. This is to work around an issue
16 * when injecting a RoutedRpcRegistration instance into a bean where Aries is not able to convert the instance
17 * returned from the RpcRegistryProvider to the desired generic RoutedRpcRegistration type specified in the
18 * bean's setter method. This is because the actual instance class specifies a generic type variable T and,
19 * even though it extends RpcService and should match, Aries doesn't handle it correctly.
21 * @author Thomas Pantelis
23 public class RoutedRpcRegistrationConverter implements Converter {
25 public boolean canConvert(final Object sourceObject, final ReifiedType targetType) {
26 return sourceObject instanceof RoutedRpcRegistration
27 && RoutedRpcRegistration.class.isAssignableFrom(targetType.getRawClass());
31 public Object convert(final Object sourceObject, final ReifiedType targetType) {