BUG-47: more subobject models
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / subobject / EROExplicitExclusionRouteSubobject.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.subobject;
9
10 import java.util.List;
11
12 import com.google.common.base.Objects.ToStringHelper;
13
14 public class EROExplicitExclusionRouteSubobject extends ExplicitRouteSubobject {
15     private final List<ExcludeRouteSubobject> xroSubobjets;
16
17     public EROExplicitExclusionRouteSubobject(List<ExcludeRouteSubobject> xroSubobjets) {
18         super();
19         this.xroSubobjets = xroSubobjets;
20     }
21
22     public List<ExcludeRouteSubobject> getXroSubobjets() {
23         return this.xroSubobjets;
24     }
25
26     @Override
27     public int hashCode() {
28         final int prime = 31;
29         int result = super.hashCode();
30         result = prime * result + ((this.xroSubobjets == null) ? 0 : this.xroSubobjets.hashCode());
31         return result;
32     }
33
34     @Override
35     public boolean equals(Object obj) {
36         if (this == obj)
37             return true;
38         if (!super.equals(obj))
39             return false;
40         if (this.getClass() != obj.getClass())
41             return false;
42         final EROExplicitExclusionRouteSubobject other = (EROExplicitExclusionRouteSubobject) obj;
43         if (this.xroSubobjets == null) {
44             if (other.xroSubobjets != null)
45                 return false;
46         } else if (!this.xroSubobjets.equals(other.xroSubobjets))
47             return false;
48         return true;
49     }
50
51     @Override
52         protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
53                 toStringHelper.add("xroSubobjets", this.xroSubobjets);
54                 return super.addToStringAttributes(toStringHelper);
55         }
56 }