KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > ac > World


1 /*
2  * Copyright 1999-2004 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  */

17
18 package org.apache.lenya.ac;
19
20 import java.io.Serializable JavaDoc;
21 import java.util.Collections JavaDoc;
22
23 /**
24  * The world.
25  * @version $Id: World.java 169164 2005-05-08 21:12:53Z gregor $
26  */

27 public final class World implements Identifiable, Serializable JavaDoc {
28     
29     /**
30      * Creates a new World object.
31      */

32     private World() {
33     }
34
35     private static World instance;
36
37     /**
38      * Returns the singleton world object.
39      * @return A world object.
40      */

41     public static World getInstance() {
42         if (instance == null) {
43             instance = new World();
44         }
45
46         return instance;
47     }
48
49     /**
50      * @see org.apache.lenya.ac.Accreditable#getAccreditables()
51      */

52     public Accreditable[] getAccreditables() {
53         return (Accreditable[]) Collections.singleton(this).toArray(new Accreditable[1]);
54     }
55 }
56
Popular Tags