郑根木 vor 2 Jahren
Ursprung
Commit
462cd07b76
2 geänderte Dateien mit 31 neuen und 31 gelöschten Zeilen
  1. +16
    -16
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/SwMap.java
  2. +15
    -15
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/MapUtil.java

+ 16
- 16
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/SwMap.java Datei anzeigen

@@ -17,15 +17,15 @@ public class SwMap extends HashMap<String, Object> {
}

public String readString(String name) {
return MapUtil.readString(this, name, null);
return MapUtil.readString(this, name);
}

public String readString(String name, String defaultValue) {
return MapUtil.readString(this, name, defaultValue);
}

public Long readLong(String name) {
return MapUtil.readLong(this, name, null);
public long readLong(String name) {
return MapUtil.readLong(this, name);
}

public Long readLong(String name, Long defaultValue) {
@@ -33,7 +33,7 @@ public class SwMap extends HashMap<String, Object> {
}

public Long[] readLongArray(String name) {
return MapUtil.readLongArray(this, name, null);
return MapUtil.readLongArray(this, name);
}

public Long[] readLongArray(String name, Long[] defaultValue) {
@@ -44,35 +44,35 @@ public class SwMap extends HashMap<String, Object> {
return MapUtil.readLongSet(this, name);
}

public Integer readInt(String name) {
return MapUtil.readInt(this, name, null);
public int readInt(String name) {
return MapUtil.readInt(this, name);
}

public Integer readInt(String name, Integer defaultValue) {
public int readInt(String name, Integer defaultValue) {
return MapUtil.readInt(this, name, defaultValue);
}

public Float readFloat(String name) {
return MapUtil.readFloat(this, name, null);
public float readFloat(String name) {
return MapUtil.readFloat(this, name);
}

public Float readFloat(String name, Float defaultValue) {
public float readFloat(String name, Float defaultValue) {
return MapUtil.readFloat(this, name, defaultValue);
}

public Double readDouble(String name) {
return MapUtil.readDouble(this, name, null);
public double readDouble(String name) {
return MapUtil.readDouble(this, name);
}

public Double readDouble(String name, Double defaultValue) {
public double readDouble(String name, Double defaultValue) {
return MapUtil.readDouble(this, name, defaultValue);
}

public Boolean readBool(String name) {
return MapUtil.readBool(this, name, false);
public boolean readBool(String name) {
return MapUtil.readBool(this, name);
}

public Boolean readBool(String name, Boolean defaultValue) {
public boolean readBool(String name, Boolean defaultValue) {
return MapUtil.readBool(this, name, defaultValue);
}



+ 15
- 15
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/MapUtil.java Datei anzeigen

@@ -12,7 +12,7 @@ public class MapUtil {
private MapUtil() {}

public static String readString(Map map, String name) {
return readString(map, name, null);
return readString(map, name, "");
}

public static String readString(Map map, String name, String defaultValue) {
@@ -25,11 +25,11 @@ public class MapUtil {
return defaultValue;
}

public static Long readLong(Map map, String name) {
return readLong(map, name, null);
public static long readLong(Map map, String name) {
return readLong(map, name, 0L);
}

public static Long readLong(Map map, String name, Long defaultValue) {
public static long readLong(Map map, String name, Long defaultValue) {
Object s = map.get(name);

if (s != null) {
@@ -109,11 +109,11 @@ public class MapUtil {
return defaultValue;
}

public static Integer readInt(Map map, String name) {
return readInt(map, name, null);
public static int readInt(Map map, String name) {
return readInt(map, name, 0);
}

public static Integer readInt(Map map, String name, Integer defaultValue) {
public static int readInt(Map map, String name, int defaultValue) {
Object s = map.get(name);

if (s != null) {
@@ -130,11 +130,11 @@ public class MapUtil {
return defaultValue;
}

public static Float readFloat(Map map, String name) {
return readFloat(map, name, null);
public static float readFloat(Map map, String name) {
return readFloat(map, name, 0.0F);
}

public static Float readFloat(Map map, String name, Float defaultValue) {
public static float readFloat(Map map, String name, float defaultValue) {
Object s = map.get(name);

if (s != null) {
@@ -151,11 +151,11 @@ public class MapUtil {
return defaultValue;
}

public static Double readDouble(Map map, String name) {
return readDouble(map, name, null);
public static double readDouble(Map map, String name) {
return readDouble(map, name, 0d);
}

public static Double readDouble(Map map, String name, Double defaultValue) {
public static double readDouble(Map map, String name, double defaultValue) {
Object s = map.get(name);

if (s != null) {
@@ -172,11 +172,11 @@ public class MapUtil {
return defaultValue;
}

public static Boolean readBool(Map map, String name) {
public static boolean readBool(Map map, String name) {
return readBool(map, name, false);
}

public static Boolean readBool(Map map, String name, Boolean defaultValue) {
public static boolean readBool(Map map, String name, boolean defaultValue) {
Object s = map.get(name);

if (s != null) {


Laden…
Abbrechen
Speichern