001
014
015 package com.liferay.portal.kernel.search;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018 import com.liferay.portal.kernel.util.ProxyFactory;
019
020 import java.util.List;
021
022
026 public class SortFactoryUtil {
027
028 public static Sort create(String fieldName, boolean reverse) {
029 return getSortFactory().create(fieldName, reverse);
030 }
031
032 public static Sort create(String fieldName, int type, boolean reverse) {
033 return getSortFactory().create(fieldName, type, reverse);
034 }
035
036 public static Sort[] getDefaultSorts() {
037 return getSortFactory().getDefaultSorts();
038 }
039
040 public static Sort getSort(
041 Class<?> clazz, int type, String orderByCol, boolean inferSortField,
042 String orderByType) {
043
044 return getSortFactory().getSort(
045 clazz, type, orderByCol, inferSortField, orderByType);
046 }
047
048 public static Sort getSort(
049 Class<?> clazz, int type, String orderByCol, String orderByType) {
050
051 return getSortFactory().getSort(clazz, type, orderByCol, orderByType);
052 }
053
054 public static Sort getSort(
055 Class<?> clazz, String orderByCol, String orderByType) {
056
057 return getSortFactory().getSort(clazz, orderByCol, orderByType);
058 }
059
060 public static SortFactory getSortFactory() {
061 PortalRuntimePermission.checkGetBeanProperty(SortFactoryUtil.class);
062
063 return _sortFactory;
064 }
065
066 public static Sort[] toArray(List<Sort> sorts) {
067 return getSortFactory().toArray(sorts);
068 }
069
070 private static final SortFactory _sortFactory =
071 ProxyFactory.newServiceTrackedInstance(SortFactory.class);
072
073 }