Package org.codelibs.fess.entity
Class DataStoreParams
java.lang.Object
org.codelibs.fess.entity.DataStoreParams
Parameter container class for data store configurations and runtime parameters.
This class provides a convenient wrapper around a Map to store and retrieve
data store specific parameters with type-safe access methods.
The class uses a ParamMap internally which provides case format conversion between camelCase and snake_case parameter names for flexible parameter access. Parameters can be stored as any Object type and retrieved with type conversion support for common types like String.
This class is commonly used to pass configuration parameters to data store implementations during crawling operations, allowing for flexible parameter handling without tight coupling to specific parameter schemas.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new empty DataStoreParams instance.protectedDataStoreParams(Map<String, Object> params) Creates a new DataStoreParams instance with a copy of the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns a copy of the internal parameter map as a standard Map.booleancontainsKey(String key) Checks if the specified key exists in the parameter map.Retrieves a parameter value by key.getAsString(String key) Retrieves a parameter value as a String.getAsString(String key, String defaultValue) Retrieves a parameter value as a String with a default value fallback.getDataMap(Map<String, Object> params) Extracts the underlying data map from a parameter map.Creates a new DataStoreParams instance with a copy of the current parameters.voidStores a parameter value with the specified key.voidAdds all key-value pairs from the specified map to this parameter container.
-
Field Details
-
params
Internal map storing parameter key-value pairs. Uses ParamMap for automatic case format conversion between camelCase and snake_case.
-
-
Constructor Details
-
DataStoreParams
public DataStoreParams()Creates a new empty DataStoreParams instance. Initializes the internal parameter map with a ParamMap wrapper. -
DataStoreParams
Creates a new DataStoreParams instance with a copy of the provided parameters. This protected constructor is used for creating new instances from existing parameter maps.- Parameters:
params- the parameter map to copy, must not be null
-
-
Method Details
-
put
Stores a parameter value with the specified key.- Parameters:
key- the parameter key, must not be nullvalue- the parameter value, may be null
-
get
Retrieves a parameter value by key.- Parameters:
key- the parameter key to look up- Returns:
- the parameter value if found, null otherwise
-
getAsString
Retrieves a parameter value as a String. If the stored value is already a String, it is returned directly. Otherwise, the toString() method is called on the value.- Parameters:
key- the parameter key to look up- Returns:
- the parameter value as a String, null if not found or value is null
-
getAsString
Retrieves a parameter value as a String with a default value fallback.- Parameters:
key- the parameter key to look updefaultValue- the default value to return if key is not found or value is null- Returns:
- the parameter value as a String, or defaultValue if not found
-
newInstance
Creates a new DataStoreParams instance with a copy of the current parameters. This provides an independent copy that can be modified without affecting the original.- Returns:
- a new DataStoreParams instance containing a copy of the current parameters
-
putAll
Adds all key-value pairs from the specified map to this parameter container.- Parameters:
map- the map containing parameters to add, must not be null
-
containsKey
Checks if the specified key exists in the parameter map.- Parameters:
key- the key to check for existence- Returns:
- true if the key exists, false otherwise
-
asMap
Returns a copy of the internal parameter map as a standard Map. The returned map is a copy and modifications will not affect this instance.- Returns:
- a new Map containing all current parameters
-
getDataMap
Extracts the underlying data map from a parameter map. If the provided map is a ParamMap instance, returns its parent map. Otherwise, returns the map as-is.- Parameters:
params- the parameter map to extract data from- Returns:
- the underlying data map
-