Class Information
Package: com.onepg.util
Class Name: AbstractIoTypeMap (Abstract Class)
Description
I/O variable-type map base class.
- A map class that provides value retrieval methods and value storage methods for each type.
- Internally stores values as strings.
- Preserves the storage order of values.
- Provides versatility by extending Map<String, String>.
- Can be made read-only by specifying a constructor argument.
- Basic rules and restrictions:
- Characters that can be used as keys are limited to lowercase letters, numbers, underscores, hyphens, and dots only.
(Only characters that can be used in JSON, and letters are unified to lowercase to eliminate DBMS differences) - In principle, value retrieval methods do not return
null. - If you want to retrieve
null, use an explicit method such as#getStringNullable(String). - In principle, value retrieval with a non-existent key results in a runtime error.
- When retrieving a value with a key that may not exist, check existence in advance using
#containsKey(Object), or retrieve using an explicit method such as#getStringOrDefault(String, String)that specifies a return value for non-existent keys. - Storing with an already existing key results in a runtime error.
- When storing a value with a key that may already exist, use an explicit method such as
#putForce(String, String). - When explicitly storing
null, use an explicit method such as#putNull(String). - Unlike normal maps, the results of
#keySet(),#entrySet(), and#values()are read-only.
(Keys are managed separately internally, and removal from the results would break consistency) - Timestamps are stored with up to 6 decimal places.
- Characters that can be used as keys are limited to lowercase letters, numbers, underscores, hyphens, and dots only.
Method List
getValMap
protected Map<String, String> getValMap()
Retrieves the value storage map.
Return Value
Map<String, String> - the value storage map
allKeySet
protected Set<String> allKeySet()
Retrieves the all key set.
Return Value
Set<String> - the all key set
validateKey
protected void validateKey(String key)
Validates the key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
String |
the key |
getVal
protected String getVal(String key)
Validates the key and retrieves the value.
Parameters
| Name | Type | Description |
|---|---|---|
key |
String |
the key |
Return Value
String - the value
putVal
protected String putVal(String key, String value, boolean canOverwrite)
Validates the key and stores the value.
Parameters
| Name | Type | Description |
|---|---|---|
key |
String |
the key |
value |
String |
the value |
canOverwrite |
boolean |
whether to allow overwriting |
Return Value
String - the previous stored value