mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 16:39:14 +08:00
update
This commit is contained in:
parent
ceef31610b
commit
9ad7492790
@ -5,18 +5,12 @@ import org.ini4j.Profile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class MiraiMapSection extends ConcurrentHashMap<String, Object> implements MiraiConfigSection {
|
||||
|
||||
public Object get(String key){
|
||||
return this.get(key,null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(String key, T defaultValue) {
|
||||
if (key == null || key.isEmpty()){
|
||||
@ -28,6 +22,17 @@ public class MiraiMapSection extends ConcurrentHashMap<String, Object> implement
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(String key) {
|
||||
if (key == null || key.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (super.containsKey(key)) {
|
||||
return (T) super.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void set(String key, Object value){
|
||||
this.put(key,value);
|
||||
}
|
||||
@ -68,6 +73,10 @@ public class MiraiMapSection extends ConcurrentHashMap<String, Object> implement
|
||||
return String.valueOf(this.get(key, defaultValue));
|
||||
}
|
||||
|
||||
public Object getObject(String key) {
|
||||
return this.get(key);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> List<T> asList(){
|
||||
return this.values().stream().map(a -> (T)(a)).collect(Collectors.toList());
|
||||
|
Loading…
Reference in New Issue
Block a user