@Test
 public void testPropertyComparatorNulls() {
   Dog dog = new Dog();
   Dog dog2 = new Dog();
   PropertyComparator c = new PropertyComparator("nickName", false, true);
   assertTrue(c.compare(dog, dog2) == 0);
 }
  @Test
  public void testPropertyComparator() {
    Dog dog = new Dog();
    dog.setNickName("mace");

    Dog dog2 = new Dog();
    dog2.setNickName("biscy");

    PropertyComparator c = new PropertyComparator("nickName", false, true);
    assertTrue(c.compare(dog, dog2) > 0);
    assertTrue(c.compare(dog, dog) == 0);
    assertTrue(c.compare(dog2, dog) < 0);
  }
Esempio n. 3
0
  @Override
  public List<DictionaryData> findDictValue(String columnValue) throws Exception {

    Dictionary dictionary =
        (Dictionary) this.findByColumn(Dictionary.class.getName(), "code", columnValue).get(0);
    Set<DictionaryData> dictionaryDatas = dictionary.getDatas();
    List<DictionaryData> list =
        new ArrayList<DictionaryData>(Arrays.asList(dictionaryDatas.toArray()));
    // 对list排序,
    PropertyComparator.sort(list, new MutableSortDefinition("id", false, true));
    return list;
  }
Esempio n. 4
0
 public List<Pet> getPets() {
   List<Pet> sortedPets = new ArrayList<>(getPetsInternal());
   PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
   return Collections.unmodifiableList(sortedPets);
 }
Esempio n. 5
0
 @XmlElement
 public List<Specialty> getSpecialties() {
   List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
   PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
   return Collections.unmodifiableList(sortedSpecs);
 }
Esempio n. 6
0
 public List<Visit> getVisits() {
   List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
   PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
   return Collections.unmodifiableList(sortedVisits);
 }