From 3622c6f340c57847234b648af0e757573dee5063 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Wed, 11 May 2011 07:35:16 +0000 Subject: [PATCH] Pull up default getProperty variants to base class Issue: SPR-8322 --- .../core/env/AbstractPropertyResolver.java | 10 ++++++++++ .../core/env/PropertySourcesPropertyResolver.java | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java index 35e20d9dbcd..ac36f02bbeb 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java @@ -55,6 +55,16 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe this.conversionService = conversionService; } + public String getProperty(String key, String defaultValue) { + String value = getProperty(key); + return value == null ? defaultValue : value; + } + + public T getProperty(String key, Class targetType, T defaultValue) { + T value = getProperty(key, targetType); + return value == null ? defaultValue : value; + } + public String getRequiredProperty(String key) throws IllegalStateException { String value = getProperty(key); if (value == null) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java b/org.springframework.core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java index 9aad2c1cb24..53cd4936c42 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java @@ -56,11 +56,6 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { return this.getProperty(key, String.class); } - public String getProperty(String key, String defaultValue) { - String value = getProperty(key); - return value == null ? defaultValue : value; - } - public T getProperty(String key, Class targetValueType) { boolean debugEnabled = logger.isDebugEnabled(); if (logger.isTraceEnabled()) { @@ -94,11 +89,6 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver { return null; } - public T getProperty(String key, Class targetType, T defaultValue) { - T value = getProperty(key, targetType); - return value == null ? defaultValue : value; - }; - public Class getPropertyAsClass(String key, Class targetValueType) { boolean debugEnabled = logger.isDebugEnabled(); if (logger.isTraceEnabled()) {