Package org.geotools.data.duckdb
Class ParamBuilder
- Object
-
- ParamBuilder
-
public class ParamBuilder extends Object
Builder forDataAccessFactory#Paraminstances.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 Constructor Description ParamBuilder(String key)Creates a new ParamBuilder with the specified key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParamBuilderadvancedLevel()Marks this parameter as an advanced-level parameter.DataAccessFactory.Parambuild()Builds and returns a DataAccessFactory.Param with the configured properties.ParamBuilderdefaultValue(Object defaultValue)Sets the default value for the parameter.ParamBuilderdescription(String description)Sets the parameter description.ParamBuilderdescription(InternationalString description)Sets the parameter description using an InternationalString.ParamBuilderlevel(String level)Sets this parameter as part of the UI interface level.ParamBuildermaxOccurs(int maxOccurs)Sets the maximum number of occurrences for this parameter.ParamBuildermetadata(String key, Object value)Adds a metadata entry to the parameter.ParamBuildermetadata(Map<String,Object> metadata)Sets the metadata map for the parameter, replacing any existing metadata.ParamBuilderminOccurs(int minOccurs)Sets the minimum number of occurrences for this parameter.ParamBuilderprogramLevel()Marks this parameter as a program-level parameter.ParamBuilderrequired(boolean required)Sets whether the parameter is required.ParamBuildertitle(String title)Sets the parameter title.ParamBuildertitle(InternationalString title)Sets the parameter title using an InternationalString.ParamBuildertype(Class<?> type)Sets the parameter type.ParamBuilderuserLevel()Marks this parameter as a user-level parameter.
-
-
-
Constructor Detail
-
ParamBuilder
public ParamBuilder(String key)
Creates a new ParamBuilder with the specified key.- Parameters:
key- the parameter key (used in parameter maps)
-
-
Method Detail
-
type
public ParamBuilder type(Class<?> type)
Sets the parameter type.- Parameters:
type- the class representing the parameter type- Returns:
- this builder for method chaining
-
description
public ParamBuilder description(String description)
Sets the parameter description.- Parameters:
description- the description text- Returns:
- this builder for method chaining
-
description
public ParamBuilder description(InternationalString description)
Sets the parameter description using an InternationalString.- Parameters:
description- the internationalized description- Returns:
- this builder for method chaining
-
title
public ParamBuilder title(String title)
Sets the parameter title.- Parameters:
title- the title text- Returns:
- this builder for method chaining
-
title
public ParamBuilder title(InternationalString title)
Sets the parameter title using an InternationalString.- Parameters:
title- the internationalized title- Returns:
- this builder for method chaining
-
required
public ParamBuilder required(boolean required)
Sets whether the parameter is required.- Parameters:
required- true if the parameter is required, false otherwise- Returns:
- this builder for method chaining
-
defaultValue
public ParamBuilder defaultValue(Object defaultValue)
Sets the default value for the parameter.- Parameters:
defaultValue- the default value- Returns:
- this builder for method chaining
-
metadata
public ParamBuilder metadata(String key, Object value)
Adds a metadata entry to the parameter.- Parameters:
key- the metadata keyvalue- the metadata value- Returns:
- this builder for method chaining
-
metadata
public ParamBuilder metadata(Map<String,Object> 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
public ParamBuilder minOccurs(int 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
-
maxOccurs
public ParamBuilder maxOccurs(int 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
-
level
public ParamBuilder level(String 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
public ParamBuilder userLevel()
Marks this parameter as a user-level parameter.- Returns:
- this builder for method chaining
-
advancedLevel
public ParamBuilder advancedLevel()
Marks this parameter as an advanced-level parameter.- Returns:
- this builder for method chaining
-
programLevel
public ParamBuilder programLevel()
Marks this parameter as a program-level parameter.- Returns:
- this builder for method chaining
-
build
public DataAccessFactory.Param 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
-
-