Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.github.kristofa.test.http;
 
Defines a query parameter key/value.

In following url: http://localhost:8081/persons?name=Smith&gender=female there are 2 query parameters: name=Smith and gender=female.

Author(s):
kristof
public class QueryParameter implements Comparable<QueryParameter> {
    private final String key;
    private final String value;

    
Creates a new instance.

Parameters:
key Key, should not be empty.
value Value, should not be empty.
    public QueryParameter(final String keyfinal String value) {
        Validate.notBlank(key);
        Validate.notNull(value);
        this. = key;
        this. = value;
    }

    
Gets key.

Returns:
Key.
    public String getKey() {
        return ;
    }

    
Gets value for key.

Returns:
Value for key.
    public String getValue() {
        return ;
    }

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

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

    
    @Override
    public String toString() {
        return  + "=" + ;
    }

    
    @Override
    public int compareTo(final QueryParameter o) {
        final int compareTo = getKey().compareTo(o.getKey());
        if (compareTo != 0) {
            return compareTo;
        }
        return getValue().compareTo(o.getValue());
    }
New to GrepCode? Check out our FAQ X