/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.controller.protocol_plugin.openflow.core.internal;

import java.util.concurrent.atomic.AtomicLong;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.openflow.protocol.OFMessage;

/**
 * This class describes an OpenFlow message with priority
 */
class PriorityMessage {
    OFMessage msg;
    int priority;
    final static AtomicLong seq = new AtomicLong();
    final long seqNum;
    boolean syncReply; // set to true if we want to be blocked until the response arrives
    
    public PriorityMessage(OFMessage msg, int priority) {
        this.msg = msg;
        this.priority = priority;
        this.seqNum = seq.getAndIncrement();
        this.syncReply = false;
    }

    public PriorityMessage(OFMessage msg, int priority, boolean syncReply) {
        this(msg, priority);
        this.syncReply = syncReply;
    }

    public OFMessage getMsg() {
        return msg;
    }

    public void setMsg(OFMessage msg) {
        this.msg = msg;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public String toString() {
        return "PriorityMessage[" + ReflectionToStringBuilder.toString(this)
                + "]";
    }
}

@@ -431,120 +431,8 @@
 g;%0A%0A
-import org.apache.commons.lang3.builder.EqualsBuilder;%0Aimport org.apache.commons.lang3.builder.HashCodeBuilder;%0A
 impo
@@ -1513,320 +1513,1176 @@
     
-return HashCodeBuilder.reflectionHashCode(this);%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        return EqualsBuilder.reflectionEquals(this, obj);%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22PriorityMessage%5B%22 + ReflectionToStringBuilder.toString(this)%0A               
+final int prime = 31;%0A        int result = 1;%0A        result = prime * result + ((msg == null) ? 0 : msg.hashCode());%0A        result = prime * result + priority;%0A        result = prime * result + (int) (seqNum %5E (seqNum %3E%3E%3E 32));%0A        result = prime * result + (syncReply ? 1231 : 1237);%0A        return result;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if (this == obj)%0A            return true;%0A        if (obj == null)%0A            return false;%0A        if (getClass() != obj.getClass())%0A            return false;%0A        PriorityMessage other = (PriorityMessage) obj;%0A        if (msg == null) %7B%0A            if (other.msg != null)%0A                return false;%0A        %7D else if (!msg.equals(other.msg))%0A            return false;%0A        if (priority != other.priority)%0A            return false;%0A        if (seqNum != other.seqNum)%0A            return false;%0A        if (syncReply != other.syncReply)%0A            return false;%0A        return true;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22PriorityMessage %5Bmsg=%22 + msg + %22, priority=%22 + priority%0A                + %22, seqNum=%22 + seqNum + %22, syncReply=%22 + syncReply
  + %22

Replace EqualsBuilder, HashBuilder, ReflectionToString