mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -50,9 +50,9 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
public String get(final CharSequence group, final CharSequence key) {
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> map = this.get(StrUtil.emptyIfNull(group));
|
||||
final LinkedHashMap<String, String> map = this.get(StrUtil.toStringOrEmpty(group));
|
||||
if (MapUtil.isNotEmpty(map)) {
|
||||
return map.get(StrUtil.str(key));
|
||||
return map.get(StrUtil.toStringOrNull(key));
|
||||
}
|
||||
} finally {
|
||||
readLock.unlock();
|
||||
@@ -100,7 +100,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 此key之前存在的值,如果没有返回null
|
||||
*/
|
||||
public String put(String group, final String key, final String value) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
writeLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.computeIfAbsent(group, k -> new LinkedHashMap<>());
|
||||
@@ -133,7 +133,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 被删除的值,如果值不存在,返回null
|
||||
*/
|
||||
public String remove(String group, final String key) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
writeLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -153,7 +153,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 是否为空
|
||||
*/
|
||||
public boolean isEmpty(String group) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -184,7 +184,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 是否包含key
|
||||
*/
|
||||
public boolean containsKey(String group, final String key) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -205,7 +205,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 是否包含值
|
||||
*/
|
||||
public boolean containsValue(String group, final String value) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -225,7 +225,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return this
|
||||
*/
|
||||
public GroupedMap clear(String group) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
writeLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -255,7 +255,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 键Set
|
||||
*/
|
||||
public Set<String> keySet(String group) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -275,7 +275,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 值
|
||||
*/
|
||||
public Collection<String> values(String group) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
@@ -305,7 +305,7 @@ public class GroupedMap extends LinkedHashMap<String, LinkedHashMap<String, Stri
|
||||
* @return 键值对
|
||||
*/
|
||||
public Set<Entry<String, String>> entrySet(String group) {
|
||||
group = StrUtil.emptyIfNull(group).trim();
|
||||
group = StrUtil.toStringOrEmpty(group).trim();
|
||||
readLock.lock();
|
||||
try {
|
||||
final LinkedHashMap<String, String> valueMap = this.get(group);
|
||||
|
@@ -149,7 +149,7 @@ public class Profile implements Serializable {
|
||||
*/
|
||||
private String fixNameForProfile(final String name) {
|
||||
Assert.notBlank(name, "Setting name must be not blank !");
|
||||
final String actralProfile = StrUtil.emptyIfNull(this.profile);
|
||||
final String actralProfile = StrUtil.toStringOrEmpty(this.profile);
|
||||
if (!name.contains(StrUtil.DOT)) {
|
||||
return StrUtil.format("{}/{}.setting", actralProfile, name);
|
||||
}
|
||||
|
@@ -247,7 +247,8 @@ public final class Props extends Properties implements TypeGetter<CharSequence>
|
||||
|
||||
@Override
|
||||
public Object getObj(final CharSequence key, final Object defaultValue) {
|
||||
return ObjUtil.defaultIfNull(getProperty(StrUtil.str(key)), defaultValue);
|
||||
Assert.notNull(key, "Key must be not null!");
|
||||
return ObjUtil.defaultIfNull(getProperty(key.toString()), defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,7 +409,7 @@ public final class Props extends Properties implements TypeGetter<CharSequence>
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public <T> T toBean(final T bean, String prefix) {
|
||||
prefix = StrUtil.emptyIfNull(StrUtil.addSuffixIfNot(prefix, StrUtil.DOT));
|
||||
prefix = StrUtil.toStringOrEmpty(StrUtil.addSuffixIfNot(prefix, StrUtil.DOT));
|
||||
|
||||
String key;
|
||||
for (final java.util.Map.Entry<Object, Object> entry : this.entrySet()) {
|
||||
|
@@ -200,7 +200,7 @@ public class TomlWriter {
|
||||
indent();
|
||||
writeKey(name);
|
||||
write(" = ");
|
||||
writeString(StrUtil.emptyIfNull(ArrayUtil.toString(array)));
|
||||
writeString(StrUtil.toStringOrEmpty(ArrayUtil.toString(array)));
|
||||
}
|
||||
} else if (value instanceof Map) {// table
|
||||
if (simpleValues) {
|
||||
|
Reference in New Issue
Block a user