| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ConfigPropertyFactoryBean |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2006-2011 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 | ||
| 17 | package org.kuali.rice.core.impl.config.property; | |
| 18 | ||
| 19 | import org.kuali.rice.core.api.config.property.ConfigContext; | |
| 20 | import org.springframework.beans.factory.FactoryBean; | |
| 21 | ||
| 22 | /** | |
| 23 | * | |
| 24 | * A FactoryBean which reads the value of the specified config parameter name and returns it. | |
| 25 | * If the config parameter does not exist, it will return null. | |
| 26 | * | |
| 27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 28 | */ | |
| 29 | 0 | public class ConfigPropertyFactoryBean implements FactoryBean { |
| 30 | ||
| 31 | private String name; | |
| 32 | ||
| 33 | public Object getObject() throws Exception { | |
| 34 | 0 | return ConfigContext.getCurrentContextConfig().getProperty(name); |
| 35 | } | |
| 36 | ||
| 37 | public Class getObjectType() { | |
| 38 | 0 | return String.class; |
| 39 | } | |
| 40 | ||
| 41 | public boolean isSingleton() { | |
| 42 | 0 | return true; |
| 43 | } | |
| 44 | ||
| 45 | public void setName(String name) { | |
| 46 | 0 | this.name = name; |
| 47 | 0 | } |
| 48 | ||
| 49 | public String getName() { | |
| 50 | 0 | return this.name; |
| 51 | } | |
| 52 | ||
| 53 | } |