Add missing copyright text
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / impl / RpcServiceMetadata.java
1 /**
2  * Copyright (c) 2013 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.codegen.impl;
9
10 import java.util.HashMap;
11 import java.util.HashSet;
12 import java.util.Map;
13 import java.util.Set;
14
15 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
16
17 import com.google.common.collect.Iterables;
18
19 final class RpcServiceMetadata {
20     private final Set<Class<? extends BaseIdentity>> contexts = new HashSet<>();
21     private final Map<String, RpcMetadata> rpcMethods = new HashMap<>();
22     private final Iterable<Class<? extends BaseIdentity>> roContexts = Iterables.unmodifiableIterable(contexts);
23
24     public Iterable<Class<? extends BaseIdentity>> getContexts() {
25         return roContexts;
26     }
27
28     public RpcMetadata getRpcMethod(final String name) {
29         return rpcMethods.get(name);
30     }
31
32     public void addContext(final Class<? extends BaseIdentity> context) {
33         contexts.add(context);
34     }
35
36     public void addRpcMethod(final String name, final RpcMetadata routingPair) {
37         rpcMethods.put(name, routingPair);
38     }
39 }