/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.jms.message;

import javax.jms.JMSException;

/**
 * <p/>
 * Message Priority.
 * </p>
 *
 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter.Cheng</a>
 * @version Revision: 1.1 Date: 2002-11-12 12:04:21
 */

public class Priority {

    private int priority = 0;

    /**
     * Default Constructor.
     */
    public Priority() {
    }

    /**
     * Create Priority with speical defaultPriority.
     *
     * @param priority
     */
    public Priority(int priority) throws JMSException {
        if(priority >= 0 && priority < 10) {
            this.priority = priority;
        }
        else {
            throw new JMSException("Invalid message defaultPriority");
        }
    }

    /**
     * Get message defaultPriority.
     *
     * @return message defaultPriority
     */
    public int getPriority() {
        return this.priority;
    }

    public String toString() {
        return "Priority " + this.priority;
    }

}
