Java Code Examples for org.springframework.beans.support.PropertyComparator#sort()

The following examples show how to use org.springframework.beans.support.PropertyComparator#sort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Vet.java    From amazon-ecs-java-microservices with Apache License 2.0 5 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs,
            new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 2
Source File: Vet.java    From amazon-ecs-java-microservices with Apache License 2.0 5 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs,
            new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 3
Source File: Vet.java    From amazon-ecs-java-microservices with Apache License 2.0 5 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs,
            new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 4
Source File: SortableDataAdapter.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: Pet.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits,
            new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}
 
Example 6
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 7
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 8
Source File: Pet.java    From audit4j-demo with Apache License 2.0 4 votes vote down vote up
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}
 
Example 9
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 10
Source File: Vet.java    From docker-workflow-plugin with MIT License 4 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 11
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 12
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 13
Source File: Owner.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 14
Source File: Owner.java    From docker-workflow-plugin with MIT License 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 15
Source File: Pet.java    From activejpa with Apache License 2.0 4 votes vote down vote up
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}
 
Example 16
Source File: Vet.java    From DevOps-for-Web-Development with MIT License 4 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 17
Source File: Pet.java    From amazon-ecs-java-microservices with Apache License 2.0 4 votes vote down vote up
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits,
            new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}
 
Example 18
Source File: Owner.java    From DevOps-for-Web-Development with MIT License 4 votes vote down vote up
public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}
 
Example 19
Source File: Vet.java    From activejpa with Apache License 2.0 4 votes vote down vote up
@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}
 
Example 20
Source File: Pet.java    From spring-graalvm-native with Apache License 2.0 4 votes vote down vote up
public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}