mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-08 20:10:01 +08:00
云快充1.5.0 初始化
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.util.property;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JCPPProperty {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.util.property;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PropertyUtils {
|
||||
|
||||
public static Map<String, String> getProps(String properties) {
|
||||
Map<String, String> configs = new HashMap<>();
|
||||
if (StringUtils.isNotEmpty(properties)) {
|
||||
for (String property : properties.split(";")) {
|
||||
if (StringUtils.isNotEmpty(property)) {
|
||||
int delimiterPosition = property.indexOf(":");
|
||||
String key = property.substring(0, delimiterPosition);
|
||||
String value = property.substring(delimiterPosition + 1);
|
||||
configs.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return configs;
|
||||
}
|
||||
|
||||
public static Map<String, String> getProps(Map<String, String> defaultProperties, String propertiesStr) {
|
||||
return getProps(defaultProperties, propertiesStr, PropertyUtils::getProps);
|
||||
}
|
||||
|
||||
public static Map<String, String> getProps(Map<String, String> defaultProperties, String propertiesStr, Function<String, Map<String, String>> parser) {
|
||||
Map<String, String> properties = defaultProperties;
|
||||
if (StringUtils.isNotBlank(propertiesStr)) {
|
||||
properties = new HashMap<>(properties);
|
||||
properties.putAll(parser.apply(propertiesStr));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user