Class ViewSpecification.Column.Builder
Object
Builder
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- ViewSpecification.Column
ViewSpecification.Column.Builder is used to create instances of ViewSpecification.Column,
and also to convert them to JSON format.
The builder may have invalid state when csid or key is null. Only the builder
in valid state can produce an instance of Column, so make sure to set those two properties.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Creates an empty builder.Builder(ViewSpecification.Column column) Creates a builder with a copy of a column properties. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates an instance ofViewSpecification.Columnusing the current state of the builder.clone()getCsid()getKey()getName()booleanisValid()removeParameter(String name) Removes a parameter from parameter map.voidvoidvoidsetParameter(String name, Object value) Sets a parameter for this column.voidsetParameters(Map<String, Object> parameters) Updates the parameter map for the column.setStringListParameter(String name, String... values) Utility method to set a parameter of typeListwithStringelements.toString()
-
Constructor Details
-
Builder
public Builder()Creates an empty builder. -
Builder
Creates a builder with a copy of a column properties. If there's a parameter map, it is copied for modification.- Parameters:
column- column to copy
-
-
Method Details
-
clone
-
getCsid
-
setCsid
-
getKey
-
setKey
-
getName
-
setName
-
getParameters
- Returns:
- parameter map, or null if no parameters are defined. This method gives access to the internal
parameter map for the sake of serializing speed. Although you can update it, it is preferrable to use
setParameter(java.lang.String, java.lang.Object)method.
-
setParameters
Updates the parameter map for the column. The map is copied by this method, so the passed object can be reused by the calling method.
Passing
nullwill clear the parameter map.- Parameters:
parameters- new parameter map
-
removeParameter
Removes a parameter from parameter map.- Parameters:
name- name of the parameter- Returns:
- this builder
-
setParameter
Sets a parameter for this column. The parameter and the value are added to the parameter map.
For the list of supported parameter types, see
ViewSpecification.Column.- Parameters:
name- the name of the parametervalue- the value of the parameter- Returns:
- this builder
- Throws:
IllegalArgumentException- if the parameter is of unsupported type
-
setStringListParameter
Utility method to set a parameter of typeListwithStringelements.- Parameters:
name- parameter namevalues- a list of values for the parameter- Returns:
- this builder
-
isValid
public boolean isValid()- Returns:
- true if this builder has a valid state and can produce
ViewSpecification.Column- that is, it has non-emptykeyand non-emptycsid
-
build
Creates an instance ofViewSpecification.Columnusing the current state of the builder. After the column is created, the state can be reused to create another instance.- Returns:
- the new immutable column
- Throws:
IllegalStateException- if the state is invalid - seeisValid()
-
toString
-