org.apache.ignite.cache.store.cassandra.persistence

## Class PersistenceSettings<F extends PojoField>

- java.lang.Object
- - org.apache.ignite.cache.store.cassandra.persistence.PersistenceSettings<F>

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    KeyPersistenceSettings, ValuePersistenceSettings

      public abstract class PersistenceSettings<F extends PojoField>
      extends Object
      implements Serializable

  Stores persistence settings, which describes how particular key/value from Ignite cache should be stored in Cassandra.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PersistenceSettings(Element el)` Constructs persistence settings from corresponding XML element.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<F>` | `cassandraUniqueFields()` List of POJO fields having unique mapping to Cassandra columns - skipping aliases pointing to the same Cassandra table column.
    `protected void` | `checkDuplicates(List<F> fields)` Checks if there are POJO filed with the same name or same Cassandra column specified in persistence settings.
    `protected abstract F` | `createPojoField(Element el, Class clazz)` Creates instance of `PojoField` based on it's description in XML element.
    `protected abstract F` | `createPojoField(F field, Class clazz)` Creates instance of `PojoField` based on the other instance and java class to initialize accessor.
    `protected abstract F` | `createPojoField(PojoFieldAccessor accessor)` Creates instance of `PojoField` from its field accessor.
    `protected abstract String` | `defaultColumnName()` Returns default name for Cassandra column (if it's not specified explicitly).
    `protected List<F>` | `detectPojoFields(NodeList fieldNodes)` Extracts POJO fields from a list of corresponding XML field nodes.
    `protected List<F>` | `enrichFields(List<F> src)` Sets accessor for the given `src` fields.
    `static PropertyDescriptor` | `findPropertyDescriptor(List<PropertyDescriptor> descriptors, String propName)` Extracts property descriptor from the descriptors list by its name.
    `String` | `getColumn()` Returns Cassandra table column name where object should be persisted in case of using BLOB or PRIMITIVE persistence strategy.
    `PojoField` | `getFieldByColumn(String column)` Returns POJO field by Cassandra table column name.
    `abstract List<F>` | `getFields()` Returns a list of POJO fields to be persisted.
    `Class` | `getJavaClass()` Returns java class of the object to be persisted.
    `Serializer` | `getSerializer()` Returns serializer to be used for BLOBs.
    `PersistenceStrategy` | `getStrategy()` Returns persistence strategy to use.
    `List<String>` | `getTableColumns()` Returns set of database column names, used to persist field values
    `String` | `getTableColumnsDDL()` Returns Cassandra table columns DDL, corresponding to POJO fields which should be persisted.
    `String` | `getTableColumnsDDL(Set<String> ignoreColumns)` Returns Cassandra table columns DDL, corresponding to POJO fields which should be persisted.
    `protected void` | `init()` Class instance initialization.

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

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

- - ### Constructor Detail

    - #### PersistenceSettings

          public PersistenceSettings(Element el)

      Constructs persistence settings from corresponding XML element.
      Parameters:
        `el` - xml element containing persistence settings configuration.

  - ### Method Detail

    - #### findPropertyDescriptor

          public static PropertyDescriptor findPropertyDescriptor(List<PropertyDescriptor> descriptors,
                                                                  String propName)

      Extracts property descriptor from the descriptors list by its name.
      Parameters:
        `descriptors` - descriptors list.
        `propName` - property name.
      Returns:
        property descriptor.

    - #### getJavaClass

          public Class getJavaClass()

      Returns java class of the object to be persisted.
      Returns:
        java class.

    - #### getStrategy

          public PersistenceStrategy getStrategy()

      Returns persistence strategy to use.
      Returns:
        persistence strategy.

    - #### getColumn

          public String getColumn()

      Returns Cassandra table column name where object should be persisted in case of using BLOB or PRIMITIVE persistence strategy.
      Returns:
        column name.

    - #### getSerializer

          public Serializer getSerializer()

      Returns serializer to be used for BLOBs.
      Returns:
        serializer.

    - #### getFields

          public abstract List<F> getFields()

      Returns a list of POJO fields to be persisted.
      Returns:
        list of fields.

    - #### getFieldByColumn

          public PojoField getFieldByColumn(String column)

      Returns POJO field by Cassandra table column name.
      Parameters:
        `column` - column name.
      Returns:
        POJO field or null if not exists.

    - #### cassandraUniqueFields

          public List<F> cassandraUniqueFields()

      List of POJO fields having unique mapping to Cassandra columns - skipping aliases pointing to the same Cassandra table column.
      Returns:
        List of fields.

    - #### getTableColumns

          public List<String> getTableColumns()

      Returns set of database column names, used to persist field values
      Returns:
        set of database column names

    - #### getTableColumnsDDL

          public String getTableColumnsDDL()

      Returns Cassandra table columns DDL, corresponding to POJO fields which should be persisted.
      Returns:
        DDL statement for Cassandra table fields.

    - #### getTableColumnsDDL

          public String getTableColumnsDDL(Set<String> ignoreColumns)

      Returns Cassandra table columns DDL, corresponding to POJO fields which should be persisted.
      Parameters:
        `ignoreColumns` - Table columns to ignore (exclude) from DDL.
      Returns:
        DDL statement for Cassandra table fields.

    - #### defaultColumnName

          protected abstract String defaultColumnName()

      Returns default name for Cassandra column (if it's not specified explicitly).
      Returns:
        column name

    - #### createPojoField

          protected abstract F createPojoField(Element el,
                                               Class clazz)

      Creates instance of `PojoField` based on it's description in XML element.
      Parameters:
        `el` - XML element describing POJO field
        `clazz` - POJO java class.

    - #### createPojoField

          protected abstract F createPojoField(PojoFieldAccessor accessor)

      Creates instance of `PojoField` from its field accessor.
      Parameters:
        `accessor` - field accessor.

    - #### createPojoField

          protected abstract F createPojoField(F field,
                                               Class clazz)

      Creates instance of `PojoField` based on the other instance and java class to initialize accessor.
      Parameters:
        `field` - PojoField instance
        `clazz` - java class

    - #### init

          protected void init()

      Class instance initialization.

    - #### checkDuplicates

          protected void checkDuplicates(List<F> fields)

      Checks if there are POJO filed with the same name or same Cassandra column specified in persistence settings.
      Parameters:
        `fields` - List of fields to be persisted into Cassandra.

    - #### detectPojoFields

          protected List<F> detectPojoFields(NodeList fieldNodes)

      Extracts POJO fields from a list of corresponding XML field nodes.
      Parameters:
        `fieldNodes` - Field nodes to process.
      Returns:
        POJO fields list.

    - #### enrichFields

          protected List<F> enrichFields(List<F> src)

      Sets accessor for the given `src` fields. Required as accessor is transient and is not present after deserialization.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021