View Javadoc

1   /*
2    * Copyright 2004 Anite - Central Government Division
3    * http://www.anite.com/publicsector
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License. You may obtain a copy of
7    * the License at
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  
18  package com.anite.antelope.managers;
19  
20  import com.anite.antelope.om.Animal;
21  import com.anite.antelope.om.Llama;
22  import com.anite.antelope.om.Moorhen;
23  
24  /***
25   * @author Ben
26   */
27  public class AnimalManager {
28  
29      private static final String LLAMA = "Llama";
30  
31      private static final String MOORHEN = "Moorhen";
32  
33      /***
34       * Create a new animal based on passed type
35       * 
36       * @param type
37       * @return
38       */
39      public Animal createAnimal(String type) {
40          if (type.equals(MOORHEN)) {
41              return new Moorhen();
42          } else if (type.equals(LLAMA)) {
43              return new Llama();
44          } else {
45              return null;
46          }
47      }
48  }