Package top.focess.qq.api.util
Class Property
- java.lang.Object
-
- top.focess.qq.api.util.Property
-
public class Property extends Object
Store some default properties of this framework.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Tget(String key)Get the value of the key in the propertiesstatic <T> TgetOrDefault(String key, T t)Get the value of the key in the properties or default value if the key is not existedstatic booleanhasKey(String key)Indicate whether it has the key or notstatic voidput(String key, Object value)Set the propertystatic voidremove(String key)Remove the property
-
-
-
Method Detail
-
hasKey
public static boolean hasKey(String key)
Indicate whether it has the key or not- Parameters:
key- the FocessQQ framework properties' key- Returns:
- true if it has the key, false otherwise
-
put
public static void put(String key, Object value)
Set the property- Parameters:
key- the FocessQQ framework properties' keyvalue- the FocessQQ framework properties' value
-
get
public static <T> T get(String key)
Get the value of the key in the properties- Type Parameters:
T- the desired T type- Parameters:
key- the FocessQQ framework properties' key- Returns:
- the desired value
- Throws:
ClassCastException- if the desired T type is not equal to its original type
-
getOrDefault
public static <T> T getOrDefault(String key, T t)
Get the value of the key in the properties or default value if the key is not existed- Type Parameters:
T- the desired T type- Parameters:
key- the FocessQQ framework properties' keyt- the default value- Returns:
- the desired value, or the default value
-
remove
public static void remove(String key)
Remove the property- Parameters:
key- the FocessQQ framework properties' key
-
-