View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.kuali.common.util.spring;
17  
18  import org.kuali.common.util.Assert;
19  import org.kuali.common.util.Project;
20  import org.kuali.common.util.ProjectUtils;
21  import org.springframework.beans.factory.FactoryBean;
22  
23  public class ProjectFactoryBean<T> implements FactoryBean<Project> {
24  
25  	String gav;
26  	boolean singleton = true;
27  
28  	@Override
29  	public Project getObject() throws Exception {
30  		Assert.hasText(gav);
31  		return ProjectUtils.loadProject(gav);
32  	}
33  
34  	@Override
35  	public Class<Project> getObjectType() {
36  		return Project.class;
37  	}
38  
39  	@Override
40  	public boolean isSingleton() {
41  		return singleton;
42  	}
43  
44  	public String getGav() {
45  		return gav;
46  	}
47  
48  	public void setGav(String gav) {
49  		this.gav = gav;
50  	}
51  
52  	public void setSingleton(boolean singleton) {
53  		this.singleton = singleton;
54  	}
55  
56  }