BUG-47 : PCEP migration to generated DTOs.
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPCloseTermination.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 one of the regular reasons was the cause of the termination of a session.
14  */
15 public final class PCEPCloseTermination extends PCEPTerminationReason {
16
17         private final TerminationReason reason;
18
19         /**
20          * Creates new Termination.
21          * 
22          * @param reason reason for termination
23          */
24         public PCEPCloseTermination(final TerminationReason reason) {
25                 super();
26                 this.reason = reason;
27         }
28
29         /* (non-Javadoc)
30          * @see org.opendaylight.protocol.pcep.PCEPTerminationReason#getErrorMessage()
31          */
32         @Override
33         public String getErrorMessage() {
34                 return this.reason.toString();
35         }
36
37         @Override
38         protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
39                 return toStringHelper.add("reason", this.reason);
40
41         }
42 }