Package org.geotools.pmtiles.store
Class ParamBuilder
Object
ParamBuilder
Builder for
DataAccessFactory#Param
instances.
Provides a fluent API for creating DataAccessFactory.Param objects, making parameter definition more readable and maintainable. This builder helps with consistent parameter creation and reduces boilerplate code.
Example usage:
DataAccessFactory.Param param = new ParamBuilder("uri")
.type(String.class)
.description("URI to the data source")
.required(true)
.metadata(Parameter.LEVEL, "advanced")
.build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMarks this parameter as an advanced-level parameter.build()
Builds and returns a DataAccessFactory.Param with the configured properties.static ParamBuilder
builder()
defaultValue
(Object defaultValue) Sets the default value for the parameter.description
(String description) Sets the parameter description.description
(InternationalString description) Sets the parameter description using an InternationalString.Sets this parameter as part of the UI interface level.Shortcut forrequired(true)
maxOccurs
(int maxOccurs) Sets the maximum number of occurrences for this parameter.Adds a metadata entry to the parameter.Sets the metadata map for the parameter, replacing any existing metadata.minOccurs
(int minOccurs) Sets the minimum number of occurrences for this parameter.optional()
Shortcut forrequired(false)
password()
Mark this parameters as a passwordpassword
(boolean isPassword) Mark whether this parameters is a passwordMarks this parameter as a program-level parameter.required
(boolean required) Sets whether the parameter is required.Sets the parameter title.title
(InternationalString title) Sets the parameter title using an InternationalString.Sets the parameter type.Marks this parameter as a user-level parameter.
-
Constructor Details
-
ParamBuilder
Creates a new ParamBuilder with the specified key.- Parameters:
key
- the parameter key (used in parameter maps)
-
-
Method Details
-
builder
-
key
-
type
Sets the parameter type.- Parameters:
type
- the class representing the parameter type- Returns:
- this builder for method chaining
-
description
Sets the parameter description.- Parameters:
description
- the description text- Returns:
- this builder for method chaining
-
description
Sets the parameter description using an InternationalString.- Parameters:
description
- the internationalized description- Returns:
- this builder for method chaining
-
title
Sets the parameter title.- Parameters:
title
- the title text- Returns:
- this builder for method chaining
-
title
Sets the parameter title using an InternationalString.- Parameters:
title
- the internationalized title- Returns:
- this builder for method chaining
-
optional
Shortcut forrequired(false)
-
mandatory
Shortcut forrequired(true)
-
required
Sets whether the parameter is required.- Parameters:
required
- true if the parameter is required, false otherwise- Returns:
- this builder for method chaining
-
defaultValue
Sets the default value for the parameter.- Parameters:
defaultValue
- the default value- Returns:
- this builder for method chaining
-
metadata
Adds a metadata entry to the parameter.- Parameters:
key
- the metadata keyvalue
- the metadata value- Returns:
- this builder for method chaining
-
metadata
Sets the metadata map for the parameter, replacing any existing metadata.- Parameters:
metadata
- the complete metadata map- Returns:
- this builder for method chaining
-
minOccurs
Sets the minimum number of occurrences for this parameter.- Parameters:
minOccurs
- the minimum number of occurrences- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException
- if minOccurs is negative- See Also:
-
maxOccurs
Sets the maximum number of occurrences for this parameter.- Parameters:
maxOccurs
- the maximum number of occurrences- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException
- if maxOccurs is less than minOccurs- See Also:
-
options
- Parameters:
options
- a speciifc Listof options can be provided for a user to choose between - See Also:
-
password
Mark this parameters as a password- Returns:
- this builder for method chaining
-
password
Mark whether this parameters is a password- Parameters:
isPassword
- whether this param is to be marked as apassword
- Returns:
- this builder for method chaining
-
level
Sets this parameter as part of the UI interface level.- Parameters:
level
- the UI level (e.g., "user", "advanced", "program")- Returns:
- this builder for method chaining
-
userLevel
Marks this parameter as a user-level parameter.- Returns:
- this builder for method chaining
-
advancedLevel
Marks this parameter as an advanced-level parameter.- Returns:
- this builder for method chaining
-
programLevel
Marks this parameter as a program-level parameter.- Returns:
- this builder for method chaining
-
build
Builds and returns a DataAccessFactory.Param with the configured properties.- Returns:
- a new DataAccessFactory.Param instance
- Throws:
IllegalStateException
- if required properties are not set
-