org.springframework.web.servlet.mvc.method.condition
Class ConsumesRequestCondition

java.lang.Object
  extended by org.springframework.web.servlet.mvc.method.condition.ConsumesRequestCondition
All Implemented Interfaces:
Comparable<ConsumesRequestCondition>, RequestCondition

public class ConsumesRequestCondition
extends Object
implements Comparable<ConsumesRequestCondition>

Represents a collection of consumes conditions, typically obtained from @RequestMapping.consumes().

Since:
3.1
Author:
Arjen Poutsma
See Also:
RequestConditionFactory.parseConsumes(String...), RequestConditionFactory.parseConsumes(String[], String[])

Nested Class Summary
protected static class MediaTypesRequestCondition.MediaTypeRequestCondition
           
 
Constructor Summary
ConsumesRequestCondition()
          Creates a default set of consumes request conditions.
 
Method Summary
 ConsumesRequestCondition combine(ConsumesRequestCondition other)
          Combines this collection of request condition with another.
 int compareTo(ConsumesRequestCondition other)
           
 boolean equals(Object o)
           
protected  Set<T> getConditions()
           
 ConsumesRequestCondition getMatchingCondition(HttpServletRequest request)
          Returns a new RequestCondition that contains all conditions of this key that match the request.
 Set<MediaType> getMediaTypes()
          Returns all MediaTypes contained in this condition.
protected  List<T> getSortedConditions()
           
protected  String getToStringInfix()
           
 int hashCode()
           
 boolean isEmpty()
           
 boolean match(HttpServletRequest request)
          Indicates whether this condition matches against the given servlet request.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsumesRequestCondition

public ConsumesRequestCondition()
Creates a default set of consumes request conditions.

Method Detail

getMatchingCondition

public ConsumesRequestCondition getMatchingCondition(HttpServletRequest request)
Returns a new RequestCondition that contains all conditions of this key that match the request.

Parameters:
request - the request
Returns:
a new request condition that contains all matching attributes, or null if not all conditions match

combine

public ConsumesRequestCondition combine(ConsumesRequestCondition other)
Combines this collection of request condition with another. Returns other, unless it is empty.

Parameters:
other - the condition to combine with

compareTo

public int compareTo(ConsumesRequestCondition other)
Specified by:
compareTo in interface Comparable<ConsumesRequestCondition>

getSortedConditions

protected List<T> getSortedConditions()

getMediaTypes

public Set<MediaType> getMediaTypes()
Returns all MediaTypes contained in this condition.


match

public boolean match(HttpServletRequest request)
Description copied from interface: RequestCondition
Indicates whether this condition matches against the given servlet request.

Parameters:
request - the request
Returns:
true if this condition matches the request; false otherwise

getToStringInfix

protected String getToStringInfix()

getConditions

protected Set<T> getConditions()

isEmpty

public boolean isEmpty()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object