BUG-47 : PCEP migration to generated DTOs.
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / UnknownObject.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;
9
10 import java.util.Arrays;
11 import java.util.List;
12
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
16 import org.opendaylight.yangtools.yang.binding.DataContainer;
17
18 public class UnknownObject implements Object {
19
20         private final Errors error;
21
22         private final PCEPErrors e;
23
24         public UnknownObject(final PCEPErrors error) {
25                 final PCEPErrorMapping mapping = PCEPErrorMapping.getInstance();
26                 this.e = error;
27                 this.error = new ErrorsBuilder().setType(mapping.getFromErrorsEnum(error).type).setValue(mapping.getFromErrorsEnum(error).value).build();
28         }
29
30         public List<Errors> getErrors() {
31                 return Arrays.asList(this.error);
32         }
33
34         public PCEPErrors getError() {
35                 return this.e;
36         }
37
38         @Override
39         public Class<? extends DataContainer> getImplementedInterface() {
40                 return Object.class;
41         }
42
43         @Override
44         public Boolean isIgnore() {
45                 return false;
46         }
47
48         @Override
49         public Boolean isProcessingRule() {
50                 return false;
51         }
52 }