ItemNameComparator.java
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.jcr.Item
* javax.jcr.RepositoryException
*/
package com.day.jcr.vault.util;
import java.util.Comparator;
import javax.jcr.Item;
import javax.jcr.RepositoryException;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class ItemNameComparator
implements Comparator<Item> {
public static final ItemNameComparator INSTANCE = new ItemNameComparator();
@Override
public int compare(Item o1, Item o2) {
try {
String n1 = o1.getName().toLowerCase();
String n2 = o2.getName().toLowerCase();
int i1 = n1.indexOf(58);
int i2 = n2.indexOf(58);
if (i1 >= 0 && i2 < 0) {
return -1;
}
if (i1 < 0 && i2 >= 0) {
return 1;
}
return n1.compareTo(n2);
}
catch (RepositoryException e) {
throw new IllegalStateException((Throwable)e);
}
}
}