001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.expando.util.comparator;
016    
017    import com.liferay.portal.security.permission.comparator.ModelResourceComparator;
018    import com.liferay.portlet.expando.model.CustomAttributesDisplay;
019    
020    import java.io.Serializable;
021    
022    import java.util.Comparator;
023    import java.util.Locale;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class CustomAttributesDisplayComparator
029            implements Comparator<CustomAttributesDisplay>, Serializable {
030    
031            public CustomAttributesDisplayComparator(Locale locale) {
032                    _modelResourceComparator = new ModelResourceComparator(locale);
033            }
034    
035            public int compare(
036                    CustomAttributesDisplay customAttributesDisplay1,
037                    CustomAttributesDisplay customAttributesDisplay2) {
038    
039                    return _modelResourceComparator.compare(
040                            customAttributesDisplay1.getClassName(),
041                            customAttributesDisplay2.getClassName());
042            }
043    
044            private ModelResourceComparator _modelResourceComparator;
045    
046    }