BUG-58: refactor to take advantage of netty
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPErrorTermination.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 com.google.common.base.Objects.ToStringHelper;
11
12 /**
13  * Used as a reason when a documented error was the cause of the
14  * termination of a session.
15  */
16 public final class PCEPErrorTermination extends PCEPTerminationReason {
17
18         private final PCEPErrors error;
19
20         /**
21          * Creates new Termination.
22          * @param error Error that happened.
23          */
24         public PCEPErrorTermination(final PCEPErrors error) {
25                 this.error = error;
26         }
27
28         /* (non-Javadoc)
29          * @see org.opendaylight.protocol.pcep.PCEPTerminationReason#getErrorMessage()
30          */
31         @Override
32         public String getErrorMessage() {
33                 return this.error.toString();
34         }
35
36         @Override
37         protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
38                 return toStringHelper.add("error", error);
39         }
40 }