KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portlet > admin > util > PortletApplicationEntityImplComparator


1 /*
2  * Copyright 2003,2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.pluto.portlet.admin.util;
17
18 import java.util.Comparator JavaDoc;
19
20 import org.apache.pluto.portalImpl.om.entity.impl.PortletApplicationEntityImpl;
21 import org.apache.pluto.portlet.admin.BaseAdminObject;
22
23 /**
24  * Implementation of Comparator for comparing Castor
25  * PortletApplicationEntityImp instances.
26  * .
27  *
28  * @author Craig Doremus
29  * @see org.apache.pluto.portalImpl.om.entity.impl.PortletApplicationEntityImpl
30  */

31 public class PortletApplicationEntityImplComparator extends BaseAdminObject implements Comparator JavaDoc {
32
33     private static final String JavaDoc CLASS_NAME = "PortletApplicationEntityImplComparator";
34     public PortletApplicationEntityImplComparator() {
35         super(CLASS_NAME);
36     }
37     /**
38      * Implementation method
39      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
40      */

41     public int compare(Object JavaDoc obj1, Object JavaDoc obj2) {
42         if (!(obj1 instanceof PortletApplicationEntityImpl) || !(obj2 instanceof PortletApplicationEntityImpl)) {
43             throw new ClassCastException JavaDoc("Wrong class type used for PortletApplicationEntityImplComparator");
44         } else {
45             PortletApplicationEntityImpl app1 = (PortletApplicationEntityImpl)obj1;
46             PortletApplicationEntityImpl app2 = (PortletApplicationEntityImpl)obj2;
47             return app1.getCastorId().compareTo(app2.getCastorId());
48         }
49     }
50
51 }
52
Popular Tags