PortletRequestInfo.java :  » Portal » uPortal-3.1.2 » org » jasig » portal » portlet » url » Java Open Source

Java Open Source » Portal » uPortal 3.1.2 
uPortal 3.1.2 » org » jasig » portal » portlet » url » PortletRequestInfo.java
/**
 * Copyright (c) 2000-2009, Jasig, Inc.
 * See license distributed with this file and available online at
 * https://www.ja-sig.org/svn/jasig-parent/tags/rel-10/license-header.txt
 */
package org.jasig.portal.portlet.url;

import java.util.Map;

import org.apache.commons.lang.Validate;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Represents data targeting a portlet for a request
 * 
 * @author Eric Dalquist
 * @version $Revision$
 */
public class PortletRequestInfo {
    private final RequestType requestType;
    private final Map<String, String[]> parameters;
    
    public PortletRequestInfo(RequestType requestType) {
        this(requestType, null);
    }

    public PortletRequestInfo(RequestType requestType, Map<String, String[]> parameters) {
        Validate.notNull(requestType, "requestType can not be null");
        
        this.requestType = requestType;
        this.parameters = parameters;
    }

    /**
     * @return the requestType
     */
    public RequestType getRequestType() {
        return this.requestType;
    }

    /**
     * @return the parameters, null if no parameters are passed
     */
    public Map<String, String[]> getParameters() {
        return this.parameters;
    }
    
    
    /**
     * @see java.lang.Object#equals(Object)
     */
    @Override
    public boolean equals(Object object) {
        if (object == this) {
            return true;
        }
        if (!(object instanceof PortletRequestInfo)) {
            return false;
        }
        PortletRequestInfo rhs = (PortletRequestInfo) object;
        return new EqualsBuilder()
            .append(this.requestType, rhs.requestType)
            .append(this.parameters, rhs.parameters)
            .isEquals();
    }
    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(665177213, 464849795)
            .append(this.requestType)
            .append(this.parameters)
            .toHashCode();
    }
    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("requestType", this.requestType)
            .append("parameters", this.parameters)
            .toString();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.