2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.protocol.pcep.subobject;
11 import java.util.Arrays;
13 import com.google.common.base.Objects.ToStringHelper;
16 * Structure of Generalized Label subobject
18 * @see <a href="http://tools.ietf.org/html/rfc3471#section-3.2">3.2.
19 * Generalized Label</a>
21 public class EROGeneralizedLabelSubobject extends EROLabelSubobject {
23 private final byte[] label;
25 public EROGeneralizedLabelSubobject(byte[] label, boolean upStream, boolean loose) {
28 if (label.length % 4 != 0)
29 throw new IllegalArgumentException("Length of label is not multiple of 4.");
34 public byte[] getLabel() {
39 public int hashCode() {
41 int result = super.hashCode();
42 result = prime * result + Arrays.hashCode(this.label);
47 public boolean equals(Object obj) {
50 if (!super.equals(obj))
52 if (this.getClass() != obj.getClass())
54 final EROGeneralizedLabelSubobject other = (EROGeneralizedLabelSubobject) obj;
55 if (!Arrays.equals(this.label, other.label))
61 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
62 toStringHelper.add("label", this.label);
63 return super.addToStringAttributes(toStringHelper);