Class ViewSpecification.Column.Builder

Object
Builder
All Implemented Interfaces:
Cloneable
Enclosing class:
ViewSpecification.Column

public static class ViewSpecification.Column.Builder extends Object implements Cloneable

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 Details

    • Builder

      public Builder()
      Creates an empty builder.
    • Builder

      public Builder(@Nullable ViewSpecification.Column column)
      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

      Overrides:
      clone in class Object
    • getCsid

      @Nullable public String getCsid()
    • setCsid

      public void setCsid(String csid)
    • getKey

      @Nullable public String getKey()
    • setKey

      public void setKey(String key)
    • getName

      @Nullable public String getName()
    • setName

      public void setName(String name)
    • getParameters

      @Nullable public Map<String,Object> 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

      public void setParameters(@Nullable Map<String,Object> parameters)

      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 null will clear the parameter map.

      Parameters:
      parameters - new parameter map
    • removeParameter

      public ViewSpecification.Column.Builder removeParameter(String name)
      Removes a parameter from parameter map.
      Parameters:
      name - name of the parameter
      Returns:
      this builder
    • setParameter

      public ViewSpecification.Column.Builder setParameter(String name, @Nullable Object value)

      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 parameter
      value - the value of the parameter
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the parameter is of unsupported type
    • setStringListParameter

      public ViewSpecification.Column.Builder setStringListParameter(String name, String... values)
      Utility method to set a parameter of type List with String elements.
      Parameters:
      name - parameter name
      values - 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-empty key and non-empty csid
    • build

      @NotNull public ViewSpecification.Column build() throws IllegalStateException
      Creates an instance of ViewSpecification.Column using 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 - see isValid()
    • toString

      public String toString()
      Overrides:
      toString in class Object