001 /**
002 * Copyright 2010-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.common.util.spring;
017
018 import org.kuali.common.util.Assert;
019 import org.kuali.common.util.Project;
020 import org.kuali.common.util.ProjectUtils;
021 import org.springframework.beans.factory.FactoryBean;
022
023 public class ProjectFactoryBean<T> implements FactoryBean<Project> {
024
025 String gav;
026 boolean singleton = true;
027
028 @Override
029 public Project getObject() {
030 Assert.hasText(gav);
031 return ProjectUtils.loadProject(gav);
032 }
033
034 @Override
035 public Class<Project> getObjectType() {
036 return Project.class;
037 }
038
039 @Override
040 public boolean isSingleton() {
041 return singleton;
042 }
043
044 public String getGav() {
045 return gav;
046 }
047
048 public void setGav(String gav) {
049 this.gav = gav;
050 }
051
052 public void setSingleton(boolean singleton) {
053 this.singleton = singleton;
054 }
055
056 }