Spring Framework PropertyComparator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework PropertyComparator class.

This code example shows how to use the following methods:
import org.springframework.beans.support.PropertyComparator;
 
public final class PackageLister { 
 
	private static final Comparator PACKAGE_COMPARATOR = 
			new PropertyComparator("implementationTitle", true, true);
	 
	private PackageLister() { 
	} 
 
	public static Collection<Package> listPackages(String[] patterns) {
		HashMap<String, Package> map = new HashMap<String, Package>();
		Package[] packages = Package.getPackages();
	    for (int i = 0; i < packages.length; i++) {
	    	String name = packages[i].getImplementationTitle(); 
	        if (name != null && matches(packages[i].getName(), patterns)) {
	        	map.put(name, packages[i]);
	        } 
	    } 
	    ArrayList<Package> result = Generics.newArrayList(map.values()); 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
        context.put(SELECTABLE_ITEMS_HOLDER_KEY, selectableItemsHolder);
 
        if( renderedProperty != null ) {
            context.put(RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
            context.put(COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
        } 
 
        return context;
    } 
 
    /** 
     * Constructor. 
     */ 
    public ShuttleListBinder() { 
        super(null, new String[] { SELECTABLE_ITEMS_HOLDER_KEY, SELECTED_ITEMS_HOLDER_KEY, SELECTED_ITEM_TYPE_KEY,
                MODEL_KEY, COMPARATOR_KEY, RENDERER_KEY, FORM_ID });
    } 
 
    /** 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    public static void sort(List list, String field, Boolean desc) {
        if (list != null && field != null) {
            boolean asc = (desc == null || !desc);
            Collections.sort(list, new PropertyComparator(field, true, asc));
        } 
    } 
 
    public static List subList(List list, Integer start, Integer rows) {
        if (list == null) {
            return null; 
        } 
        int total = list.size();
        if (total > 0) {
            int begin = (start != null) ? start : 0;
            int end;
            if (begin < 0) {
                begin = 0;
            } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    public List<User> searchUsers(final UsersSearchCriteria searchCriteria, final int firstResult, final int maxResults, final String sortProperty, final boolean ascending){
        final String searchTerm = searchCriteria != null? searchCriteria.getSearchTerm() : null;
        final List<User> users = userManager.search(searchTerm);
        if(StringUtils.isNotEmpty(sortProperty)) {
            log.debug(String.format("Sorting usersList by property='%s', ascending='%s'", sortProperty, ascending));
            Collections.sort(users, new PropertyComparator(sortProperty, true, ascending));
        } 
        final int fromIndex = Math.min(firstResult, users.size());
        final int toIndex = Math.min(fromIndex + maxResults, users.size());
        log.debug(String.format("searchUsers(%d,%d) %d-%d [%d]", firstResult, maxResults, fromIndex, toIndex, users.size()));
        return users.subList(fromIndex, toIndex);
    } 
 
    /** 
     *  
     * @param user 
     */ 
    @Override 
    public void removeUser(final Long userId) {
        userManager.removeUser(userId.toString());
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java