NetletAttributeComparator.java :  » Portal » Open-Portal » com » sun » portal » netlet » admin » model » Java Open Source

Java Open Source » Portal » Open Portal 
Open Portal » com » sun » portal » netlet » admin » model » NetletAttributeComparator.java
/** 
 * Copyright 2002 Sun Microsystems, Inc. All 
 * rights reserved. Use of this product is subject 
 * to license terms. Federal Acquisitions: 
 * Commercial Software -- Government Users 
 * Subject to Standard License Terms and 
 * Conditions. 
 * 
 * Sun, Sun Microsystems, the Sun logo, and Sun ONE 
 * are trademarks or registered trademarks of Sun Microsystems, 
 * Inc. in the United States and other countries. 
 *
 * @ Author Bhavanishankar
 */
package com.sun.portal.netlet.admin.model;

// JDK classes

import com.iplanet.am.sdk.AMAttributeSchema;
import com.sun.portal.log.common.PortalLogger;

import java.util.Comparator;

public class NetletAttributeComparator implements Comparator {

    /*
     * Same as compareTo method of class String and compares the i18nKeys.
     *
     * @param o1 Object of type AttributeSchema
     * @param o2 Object of type AttributeSchema
     * @return the value 0 if o1's key is equal to o2's key; 
     * a value less than 0 if o1's key is lexicographically less than 
     * the o2's key; and a value greater than 0 if o1's key
     * is lexicographically greater than the o2's key.
     */
    
    public int compare(Object o1, Object o2) {
        AMAttributeSchema as1 = (AMAttributeSchema) o1;
        AMAttributeSchema as2 = (AMAttributeSchema) o2;
        String key1 = as1.getI18NKey();
        String key2 = as2.getI18NKey();
        return key1.compareTo(key2);
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.