d28b3b5c9182b031cc0521f3f22d6b52f698c377
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / impl / forward / DomForwardingUtils.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.binding.impl.forward;
9
10 import com.google.common.base.Preconditions;
11
12 public class DomForwardingUtils {
13
14     public static boolean isDomForwardedBroker(Object obj) {
15         return obj instanceof DomForwardedBroker;
16     }
17
18     public static void reuseForwardingFrom(Object target,Object source) {
19         Preconditions.checkArgument(isDomForwardedBroker(source));
20         Preconditions.checkArgument(isDomForwardedBroker(target));
21         DomForwardedBroker forwardedSource = (DomForwardedBroker) source;
22         DomForwardedBroker forwardedTarget = (DomForwardedBroker) target;
23         reuseForwardingFrom(forwardedTarget, forwardedSource);
24
25     }
26
27     private static void reuseForwardingFrom(DomForwardedBroker target, DomForwardedBroker source) {
28         target.setConnector(source.getConnector());
29         target.setDomProviderContext(source.getDomProviderContext());
30     }
31
32 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.