Rename .java to .kt
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.script;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SimpleBindings implements Bindings {
|
||||
private Map<String, Object> map;
|
||||
|
||||
public SimpleBindings(Map<String, Object> m) {
|
||||
if (m == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.map = m;
|
||||
}
|
||||
|
||||
public SimpleBindings() {
|
||||
this(new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object put(String name, Object value) {
|
||||
this.checkKey(name);
|
||||
return this.map.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends String, ? extends Object> toMerge) {
|
||||
if (toMerge == null) {
|
||||
throw new NullPointerException("toMerge map is null");
|
||||
}
|
||||
for (Map.Entry<? extends String, ? extends Object> entry : toMerge.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
this.checkKey(key);
|
||||
this.put(key, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
this.checkKey(key);
|
||||
return this.map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return this.map.containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<String, Object>> entrySet() {
|
||||
return this.map.entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(Object key) {
|
||||
this.checkKey(key);
|
||||
return this.map.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
return this.map.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object remove(Object key) {
|
||||
this.checkKey(key);
|
||||
return this.map.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Object> values() {
|
||||
return this.map.values();
|
||||
}
|
||||
|
||||
private void checkKey(Object key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key can not be null");
|
||||
}
|
||||
if (!(key instanceof String)) {
|
||||
throw new ClassCastException("key should be a String");
|
||||
}
|
||||
if (key.equals("")) {
|
||||
throw new IllegalArgumentException("key can not be empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user