Copyright© 2008-2018 SiteVision AB, all rights reserved.
@Requireable(value="SortBuilder") public interface SortBuilder extends Builder<Sort>
Builder for creating a Sort
component with specific behaviour.
SortBuilder has one mandatory attribute:
Using the SortBuilder is pretty straightforward, if you remember that it is stateful. Conceptually you would typically use it like this:
When you have built a Sort
instance, you can re-use the SortBuilder to build more instances. Typically like:
Example of how this strategy could be implemented in Velocity:
## Get the factory and the builder
#set ($searchFactory = $sitevisionUtils.searchFactory)
#set ($sortBuilder = $searchFactory.sortBuilder)
## Create a Sort
#set ($searchSortField = $searchFactory.getSearchSortField('lastpublished', true))
#set ($updatedDescSort = $sortBuilder.addSortField($searchSortField).build())
## Re-use the builder to create another Sort
#set ($searchSortField = $searchFactory.getSearchSortField('name.sortable', false))
#set ($nameAscSort = $sortBuilder.clearSortFields().addSortField($searchSortField).build())
Tip! The Builder interface documentation
contains
more information about Builders and how to work with them!
An instance of the SiteVision class implementing this interface can be obtained via
SearchFactory.getSortBuilder()
.
See SearchFactory
for how to obtain an instance of the SearchFactory
interface.
Modifier and Type | Method and Description |
---|---|
SortBuilder |
addSortField(SearchSortField aSearchSortField)
Adds a sort field.
|
Sort |
build()
Creates a Sort component instance using currently specified state/behaviour.
|
SortBuilder |
clearSortFields()
Removes all previously added sort fields.
|
SortBuilder addSortField(SearchSortField aSearchSortField)
aSearchSortField
- a sort field, a null
value is ignoredSortBuilder clearSortFields()
SiteVision - Portal and Content Management Made Easy
SiteVision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2018 SiteVision AB, all rights reserved.