01: /**
02: * Copyright 2002 Sun Microsystems, Inc. All
03: * rights reserved. Use of this product is subject
04: * to license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users
06: * Subject to Standard License Terms and
07: * Conditions.
08: *
09: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
10: * are trademarks or registered trademarks of Sun Microsystems,
11: * Inc. in the United States and other countries.
12: *
13: * @ Author Bhavanishankar
14: */package com.sun.portal.netlet.admin.model;
15:
16: // JDK classes
17:
18: import com.iplanet.am.sdk.AMAttributeSchema;
19: import com.sun.portal.log.common.PortalLogger;
20:
21: import java.util.Comparator;
22:
23: public class NetletAttributeComparator implements Comparator {
24:
25: /*
26: * Same as compareTo method of class String and compares the i18nKeys.
27: *
28: * @param o1 Object of type AttributeSchema
29: * @param o2 Object of type AttributeSchema
30: * @return the value 0 if o1's key is equal to o2's key;
31: * a value less than 0 if o1's key is lexicographically less than
32: * the o2's key; and a value greater than 0 if o1's key
33: * is lexicographically greater than the o2's key.
34: */
35:
36: public int compare(Object o1, Object o2) {
37: AMAttributeSchema as1 = (AMAttributeSchema) o1;
38: AMAttributeSchema as2 = (AMAttributeSchema) o2;
39: String key1 = as1.getI18NKey();
40: String key2 = as2.getI18NKey();
41: return key1.compareTo(key2);
42: }
43:
44: }
|