类 EnvironmentUtils
java.lang.Object
spring.turbo.core.EnvironmentUtils
Environment相关工具- 从以下版本开始:
- 1.0.0
- 作者:
- 应卓
- 另请参阅:
-
方法概要
修饰符和类型方法说明static StringgetPropertyValue(String propertyName) 获取PropertyValuestatic <T> TgetPropertyValue(String propertyName, Class<T> targetType) 获取PropertyValuestatic <T> TgetPropertyValue(String propertyName, Class<T> targetType, T defaultIfNull) 获取PropertyValuestatic StringgetRequiredPropertyValue(String propertyName) 获取PropertyValuestatic <T> TgetRequiredPropertyValue(String propertyName, Class<T> targetType) 获取PropertyValuestatic <T> TgetRequiredPropertyValue(String propertyName, Class<T> targetType, T defaultIfNull) 获取PropertyValuestatic StringresolvePlaceholders(String text) 解析placeholderstatic String解析placeholder
-
方法详细资料
-
resolvePlaceholders
解析placeholder- 参数:
text- 解析的文本- 返回:
- 解析结果
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
resolveRequiredPlaceholders
解析placeholder- 参数:
text- 解析的文本- 返回:
- 解析结果
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例IllegalArgumentException- 任意一个解析项无法满足
-
getPropertyValue
获取PropertyValue- 参数:
propertyName- property名- 返回:
- 结果或
null - 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
getRequiredPropertyValue
获取PropertyValue- 参数:
propertyName- property名- 返回:
- 结果
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例IllegalArgumentException- 无法找到property名相对的值
-
getPropertyValue
获取PropertyValue- 类型参数:
T- 目标类型泛型- 参数:
propertyName- property名targetType- 目标类型- 返回:
- 结果或
null - 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
getRequiredPropertyValue
获取PropertyValue- 类型参数:
T- 目标类型泛型- 参数:
propertyName- property名targetType- 目标类型- 返回:
- 结果
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例IllegalArgumentException- 无法找到property名相对的值
-
getPropertyValue
@Nullable public static <T> T getPropertyValue(String propertyName, Class<T> targetType, @Nullable T defaultIfNull) 获取PropertyValue- 类型参数:
T- 目标类型泛型- 参数:
propertyName- property名targetType- 目标类型defaultIfNull- 默认值- 返回:
- 结果或默认值 (可能为null)
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
getRequiredPropertyValue
public static <T> T getRequiredPropertyValue(String propertyName, Class<T> targetType, @Nullable T defaultIfNull) 获取PropertyValue- 类型参数:
T- 目标类型泛型- 参数:
propertyName- property名targetType- 目标类型defaultIfNull- 默认值- 返回:
- 结果或默认值 (可能为null)
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例IllegalArgumentException- 无法找到property名相对的值
-