BUG-47 : unfinished PCEP migration to generated DTOs.
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / RawMessage.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.protocol.pcep.spi;
9
10 import java.util.List;
11
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
13
14 /**
15  * Class representing raw message.
16  */
17 public class RawMessage implements Message {
18         private final PCEPMessageType msgType;
19         private final List<Object> objects;
20
21         public RawMessage(final List<Object> objects, final PCEPMessageType msgType) {
22                 this.msgType = msgType;
23                 if (objects.contains(null)) {
24                         throw new IllegalArgumentException("Object list contains null element at offset " + objects.indexOf(null));
25                 }
26                 this.objects = objects;
27         }
28
29         public PCEPMessageType getMsgType() {
30                 return this.msgType;
31         }
32
33         public List<Object> getAllObjects() {
34                 return this.objects;
35         }
36
37         @Override
38         public Class<Message> getImplementedInterface() {
39                 return Message.class;
40         }
41 }