public class

MutableSortDefinition

extends Object
implements Serializable SortDefinition
java.lang.Object
   ↳ org.springframework.beans.support.MutableSortDefinition

Class Overview

Mutable implementation of the SortDefinition interface. Supports toggling the ascending value on setting the same property again.

Summary

Public Constructors
MutableSortDefinition()
Create an empty MutableSortDefinition, to be populated via its bean properties.
MutableSortDefinition(SortDefinition source)
Copy constructor: create a new MutableSortDefinition that mirrors the given sort definition.
MutableSortDefinition(String property, boolean ignoreCase, boolean ascending)
Create a MutableSortDefinition for the given settings.
MutableSortDefinition(boolean toggleAscendingOnSameProperty)
Create a new MutableSortDefinition.
Public Methods
boolean equals(Object other)
String getProperty()
Return the name of the bean property to compare.
int hashCode()
boolean isAscending()
Return whether to sort ascending (true) or descending (false).
boolean isIgnoreCase()
Return whether upper and lower case in String values should be ignored.
boolean isToggleAscendingOnProperty()
Return whether to toggle the ascending flag if the same property gets set again (that is, setProperty(String) gets called with already set property name again).
void setAscending(boolean ascending)
Set whether to sort ascending (true) or descending (false).
void setIgnoreCase(boolean ignoreCase)
Set whether upper and lower case in String values should be ignored.
void setProperty(String property)
Set the property to compare.
void setToggleAscendingOnProperty(boolean toggleAscendingOnProperty)
Set whether to toggle the ascending flag if the same property gets set again (that is, setProperty(String) gets called with already set property name again).
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.support.SortDefinition

Public Constructors

public MutableSortDefinition ()

Also: SpringBeans

Create an empty MutableSortDefinition, to be populated via its bean properties.

public MutableSortDefinition (SortDefinition source)

Also: SpringBeans

Copy constructor: create a new MutableSortDefinition that mirrors the given sort definition.

Parameters
source the original sort definition

public MutableSortDefinition (String property, boolean ignoreCase, boolean ascending)

Also: SpringBeans

Create a MutableSortDefinition for the given settings.

Parameters
property the property to compare
ignoreCase whether upper and lower case in String values should be ignored
ascending whether to sort ascending (true) or descending (false)

public MutableSortDefinition (boolean toggleAscendingOnSameProperty)

Also: SpringBeans

Create a new MutableSortDefinition.

Parameters
toggleAscendingOnSameProperty whether to toggle the ascending flag if the same property gets set again (that is, setProperty gets called with already set property name again).

Public Methods

public boolean equals (Object other)

public String getProperty ()

Also: SpringBeans

Return the name of the bean property to compare. Can also be a nested bean property path.

public int hashCode ()

public boolean isAscending ()

Also: SpringBeans

Return whether to sort ascending (true) or descending (false).

public boolean isIgnoreCase ()

Also: SpringBeans

Return whether upper and lower case in String values should be ignored.

public boolean isToggleAscendingOnProperty ()

Also: SpringBeans

Return whether to toggle the ascending flag if the same property gets set again (that is, setProperty(String) gets called with already set property name again).

public void setAscending (boolean ascending)

Also: SpringBeans

Set whether to sort ascending (true) or descending (false).

public void setIgnoreCase (boolean ignoreCase)

Also: SpringBeans

Set whether upper and lower case in String values should be ignored.

public void setProperty (String property)

Also: SpringBeans

Set the property to compare.

If the property was the same as the current, the sort is reversed if "toggleAscendingOnProperty" is activated, else simply ignored.

public void setToggleAscendingOnProperty (boolean toggleAscendingOnProperty)

Also: SpringBeans

Set whether to toggle the ascending flag if the same property gets set again (that is, setProperty(String) gets called with already set property name again).

This is particularly useful for parameter binding through a web request, where clicking on the field header again might be supposed to trigger a resort for the same field but opposite order.