org.apache.cayenne.access.jdbc

## Class RowDescriptorBuilder

- java.lang.Object
- - org.apache.cayenne.access.jdbc.RowDescriptorBuilder

-     public class RowDescriptorBuilder
      extends Object

  A builder class that helps to assemble `RowDescriptor` instances from various types of inputs.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.commons.collections.Transformer` | `caseTransformer`
    `protected ColumnDescriptor[]` | `columns`
    `protected ResultSetMetaData` | `resultSetMetadata`
    `protected Map<String,String>` | `typeOverrides`
    `protected boolean` | `validateDuplicateColumnNames`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RowDescriptorBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RowDescriptor` | `getDescriptor(ExtendedTypeMap typeMap)` Returns a RowDescriptor built based on the builder internal state.
    `boolean` | `isOverriden(String columnName)`
    `protected ColumnDescriptor[]` | `mergeResultSetAndPresetColumns()`
    `RowDescriptorBuilder` | `overrideColumnType(String columnName, String type)`
    `RowDescriptorBuilder` | `setColumns(ColumnDescriptor[] columns)` Sets an explicit set of columns.
    `RowDescriptorBuilder` | `setResultSet(ResultSet resultSet)`
    `RowDescriptorBuilder` | `useLowercaseColumnNames()`
    `RowDescriptorBuilder` | `useUppercaseColumnNames()`
    `RowDescriptorBuilder` | `validateDuplicateColumnNames()` Validate and report duplicate names of columns.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### columns

          protected ColumnDescriptor[] columns

    - #### resultSetMetadata

          protected ResultSetMetaData resultSetMetadata

    - #### caseTransformer

          protected org.apache.commons.collections.Transformer caseTransformer

    - #### typeOverrides

          protected Map<String,String> typeOverrides

    - #### validateDuplicateColumnNames

          protected boolean validateDuplicateColumnNames

  - ### Constructor Detail

    - #### RowDescriptorBuilder

          public RowDescriptorBuilder()

  - ### Method Detail

    - #### getDescriptor

          public RowDescriptor getDescriptor(ExtendedTypeMap typeMap)
                                      throws SQLException,
                                             IllegalStateException

      Returns a RowDescriptor built based on the builder internal state.
      Throws:
        `SQLException`
        `IllegalStateException`

    - #### mergeResultSetAndPresetColumns

          protected ColumnDescriptor[] mergeResultSetAndPresetColumns()
                                                               throws SQLException

      Returns:
        array of columns for ResultSet with overriding ColumnDescriptors from 'columns' Note: column will be overlooked, if column name is empty
      Throws:
        `SQLException`

    - #### setColumns

          public RowDescriptorBuilder setColumns(ColumnDescriptor[] columns)

      Sets an explicit set of columns. Note that the array passed as an argument can later be modified by the build to enforce column capitalization policy and columns Java types overrides.

    - #### setResultSet

          public RowDescriptorBuilder setResultSet(ResultSet resultSet)
                                            throws SQLException

      Throws:
        `SQLException`

    - #### useLowercaseColumnNames

          public RowDescriptorBuilder useLowercaseColumnNames()

    - #### useUppercaseColumnNames

          public RowDescriptorBuilder useUppercaseColumnNames()

    - #### overrideColumnType

          public RowDescriptorBuilder overrideColumnType(String columnName,
                                                         String type)

    - #### validateDuplicateColumnNames

          public RowDescriptorBuilder validateDuplicateColumnNames()

      Validate and report duplicate names of columns.
      Returns:
        this builder

    - #### isOverriden

          public boolean isOverriden(String columnName)

Copyright © 2001–2023 Apache Cayenne. All rights reserved.