mirror of
https://gitee.com/ssssssss-team/magic-api.git
synced 2026-06-09 18:32:16 +08:00
fix
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package org.ssssssss.magicapi.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Attributes<T> {
|
||||
|
||||
protected Map<String, T> properties = new HashMap<>();
|
||||
|
||||
public void setAttribute(String key, T value) {
|
||||
properties.put(key, value);
|
||||
}
|
||||
|
||||
public Object getAttribute(String key) {
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
public Map<String, T> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, T> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,72 @@
|
||||
package org.ssssssss.magicapi.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class DataSourceInfo extends HashMap<String, String> {
|
||||
public class DataSourceInfo extends Attributes<String> implements Map<String, String> {
|
||||
|
||||
public String getId() {
|
||||
return get("id");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return properties.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return properties.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return properties.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return properties.containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(Object key) {
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String put(String key, String value) {
|
||||
return properties.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String remove(Object key) {
|
||||
return properties.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends String, ? extends String> m) {
|
||||
properties.putAll(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
properties.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
return properties.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> values() {
|
||||
return properties.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, String>> entrySet() {
|
||||
return properties.entrySet();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.ssssssss.magicapi.model;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Group {
|
||||
public class Group extends Attributes<Object> {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.ssssssss.magicapi.model;
|
||||
|
||||
public class MagicEntity implements Cloneable {
|
||||
public class MagicEntity extends Attributes<Object> implements Cloneable {
|
||||
|
||||
protected String id;
|
||||
|
||||
|
||||
@@ -29,9 +29,4 @@ public abstract class ApiServiceProvider extends StoreServiceProvider<ApiInfo> {
|
||||
return infos.values().stream()
|
||||
.anyMatch(it -> !info.getId().equals(it.getId()) && info.getGroupId().equals(it.getGroupId()) && (info.getName().equals(it.getName()) || (info.getMethod().equals(it.getMethod()) && info.getPath().equals(it.getPath()))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(ApiInfo info) {
|
||||
return super.serialize(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,4 @@ public abstract class FunctionServiceProvider extends StoreServiceProvider<Funct
|
||||
return infos.values().stream()
|
||||
.anyMatch(it -> !info.getId().equals(it.getId()) && info.getGroupId().equals(it.getGroupId()) && (info.getName().equals(it.getName()) || info.getPath().equals(it.getPath())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(FunctionInfo info) {
|
||||
return super.serialize(info);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user