当前位置: 首页>>代码示例>>Java>>正文


Java PropertyComparator类代码示例

本文整理汇总了Java中org.springframework.beans.support.PropertyComparator的典型用法代码示例。如果您正苦于以下问题:Java PropertyComparator类的具体用法?Java PropertyComparator怎么用?Java PropertyComparator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertyComparator类属于org.springframework.beans.support包,在下文中一共展示了PropertyComparator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: channels

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
@RequestMapping("/t/{tempo}/channels")
public DeferredResult<ModelAndView> channels(@PathVariable("tempo") Tempo tempo) {
    DeferredResult<ModelAndView> deferred = new DeferredResult<>();

    channelsRegistry
        .listChannels(tempo)
        .whenComplete((channels, throwable) -> {
            if (throwable != null) {
                deferred.setErrorResult(throwable);
            }
            else {
                List<Channel> sorted = channels.stream().sorted(new PropertyComparator<>("name", true, true)).collect(toList());

                ModelAndView mav = new ModelAndView("channels")
                    .addObject("tempo", tempo)
                    .addObject("gameModes", gameModes)
                    .addObject("channels", sorted);

                deferred.setResult(mav);
            }
        });

    return deferred;
}
 
开发者ID:nosceon,项目名称:tenorite,代码行数:25,代码来源:TempoController.java

示例2: setOrder

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setOrder(final List<Long> ids) {
    int order = 0;
    for (Long id : ids) {
        CF field = loadChecked(id);
        field.setOrder(++order);
        List<CustomField> children = new ArrayList<CustomField>(field.getChildren());
        if (CollectionUtils.isNotEmpty(children)) {
            Collections.sort(children, new PropertyComparator("name", true, true));
            for (CustomField child : children) {
                child.setOrder(++order);
            }
        }
    }
    getCache().clear();
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:18,代码来源:BaseCustomFieldServiceImpl.java

示例3: getSpecialties

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs,
            new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
开发者ID:awslabs,项目名称:amazon-ecs-java-microservices,代码行数:8,代码来源:Vet.java

示例4: sort

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
/**
 * Sorts the input string using property comparator. The property must have a getter and must be primitive type or
 * to implement Comparable. The sort is not case sensitive if the property is character based.
 *
 * @param listToSort Modifiable list to sort
 * @param sortParam  The property to sort by and is ascending or descending.
 */
public static void sort(List listToSort, SortParam sortParam) {
    if (!listToSort.isEmpty() && sortParam != null) {
        final String property = sortParam.getProperty();
        if (StringUtils.hasText(property)) {
            final SortDefinition sortDefinition = new MutableSortDefinition(property, true,
                    sortParam.isAscending());
            Collections.sort(listToSort, new PropertyComparator(sortDefinition));
        }
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:18,代码来源:ListPropertySorter.java

示例5: sortList

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
private void sortList(List<D> list, SortParam sortParam) {
    if (sortParam != null && sortParam.getProperty().startsWith("detail.")) {
        ListPropertySorter.sort(list, sortParam);
        final String property = sortParam.getProperty().substring(7);
        final SortDefinition sortDefinition = new MutableSortDefinition(property, true, sortParam.isAscending());
        Collections.sort(list, new PropertyComparator(sortDefinition));
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:MasterDetailRowPanel.java

示例6: iterator

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
public Iterator iterator(int first, int count) {
    final SortParam sortParam = getSort();
    if (sortParam != null && sortParam.getProperty().startsWith("master.")) {
        ListPropertySorter.sort(list, sortParam);
        final String property = sortParam.getProperty().substring(7);
        final SortDefinition sortDefinition = new MutableSortDefinition(property, true,
                sortParam.isAscending());
        Collections.sort(list, new PropertyComparator(sortDefinition));
    }
    List<?> result = list.subList(first, first + count);
    return result.iterator();
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:15,代码来源:MasterDetailTable.java

示例7: createBoundComboBox

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
public Binding createBoundComboBox(String formProperty, Object selectableItems, String renderedProperty) {
    Map context = createContext(ComboBoxBinder.SELECTABLE_ITEMS_KEY, selectableItems);
    context.put(ComboBoxBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
    context.put(ComboBoxBinder.EDITOR_KEY, new BeanPropertyEditorClosure(renderedProperty));
    context.put(ComboBoxBinder.COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
    return createBinding(JComboBox.class, formProperty, context);
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:8,代码来源:SwingBindingFactory.java

示例8: setUpBinding

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
protected String setUpBinding() {

        lb = new ListBinder();
        context = new HashMap();

        selectableItems = Arrays.asList(new Object[] {new Item("A"), new Item("B"), new Item("C"), new Item("D"),
                new Item("E")});

        context.put(ListBinder.SELECTABLE_ITEMS_KEY, selectableItems);
        context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer("name"));
        context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator("name", true, false));

        return "listProperty";
    }
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:15,代码来源:ListBinderAbstractTests.java

示例9: iterator

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
@Override
public Iterator<T> iterator(long first, long count) {
	long size = provider.size();
	List<T> resources = new ArrayList<T>((int) size);
	Iterator<? extends T> iter = provider.iterator(0, size);
	while (iter.hasNext()) {
		resources.add(iter.next());
	}

	if (comparators != null) {
		SortParam<String> sortParam = getSort();
		if (sortParam != null) {
			String sortProperty = sortParam.getProperty();
			if (sortProperty != null) {
				Comparator<T> comparator = comparators.get(sortProperty);
				if (comparator != null) {
					Collections.sort(resources, comparator);
					if (getSort().isAscending() == false) {
						Collections.reverse(resources);
					}
				} else {
					SortDefinition sortDefinition = new MutableSortDefinition(sortProperty, true, getSort().isAscending());
					PropertyComparator.sort(resources, sortDefinition);
				}						
			}
		}
	}
	
	return Collections.unmodifiableList(resources.subList((int) first, (int) (first + count))).iterator();
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:31,代码来源:SortableDataAdapter.java

示例10: getPets

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
开发者ID:awslabs,项目名称:amazon-ecs-java-microservices,代码行数:6,代码来源:Owner.java

示例11: getVisits

import org.springframework.beans.support.PropertyComparator; //导入依赖的package包/类
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits,
            new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}
 
开发者ID:awslabs,项目名称:amazon-ecs-java-microservices,代码行数:7,代码来源:Pet.java


注:本文中的org.springframework.beans.support.PropertyComparator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。