com.h3c.util.persistence.cassandra.entitymgr

## Class CassandraStorable<I extends Serializable,K extends Serializable & Comparable<K>>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.entitymgr.CassandraStorable<I,K>

- Type Parameters:
    `I` - type of the row key
    `K` - type of the column key or name
  All Implemented Interfaces:
    Storable<I>

      public final class CassandraStorable<I extends Serializable,K extends Serializable & Comparable<K>>
      extends Object
      implements Storable<I>

  Cassandra Storable.

  Cassandra stores data in the following format:

  Map<RowKey, SortedMap<ColumnKey, ColumnValue>>

  This class is not thread-safe, but it doesn't have to because the DAO won't use it in a multi-thread environment since instances of this class are not shared among threads.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CassandraStorable(I id)` Creates a cassandra persistent object.
    `CassandraStorable(I id, String sysId)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `delete(ColumnName<K,?> name)` Deletes a column.
    `Column<K,?>` | `getColumn(ColumnName<K,?> name)` Gets the value of the given column.
    `Collection<Column<K,?>>` | `getColumns()` Gets the columns.
    `Set<ColumnName<K,?>>` | `getDeletedColumns()` Gets the columns.
    `I` | `getId()` Retrieve the Row Key associated with the Storable.
    `String` | `getSysId()`
    `void` | `setColumn(Column<K,?> column)` Sets a column.

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

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

- - ### Constructor Detail

    - #### CassandraStorable

          public CassandraStorable(I id)

      Creates a cassandra persistent object.
      Parameters:
        `id` - row key

    - #### CassandraStorable

          public CassandraStorable(I id,
                           String sysId)

  - ### Method Detail

    - #### getId

          public I getId()

      Description copied from interface: `Storable`
      Retrieve the Row Key associated with the Storable. Unless it is a batch operation, the Storable maps to one row of a Column Family. This method is used to retrieve the Row Key for a given row.
      Specified by:
        `getId` in interface `Storable<I extends Serializable>`
      Returns:
        The Object Identification (Row Key)

    - #### getColumn

          public Column<K,?> getColumn(ColumnName<K,?> name)

      Gets the value of the given column.
      Parameters:
        `name` - name of the column to get
      Returns:
        the column if it exists, `null` otherwise

    - #### setColumn

          public void setColumn(Column<K,?> column)

      Sets a column. If the column already exists it is replaced.
      Parameters:
        `column` - column to set

    - #### getSysId

          public String getSysId()

    - #### delete

          public void delete(ColumnName<K,?> name)

      Deletes a column.
      Parameters:
        `name` - name of the column to delete

    - #### getColumns

          public Collection<Column<K,?>> getColumns()

      Gets the columns.
      Returns:
        the columns

    - #### getDeletedColumns

          public Set<ColumnName<K,?>> getDeletedColumns()

      Gets the columns.
      Returns:
        the columns

Copyright © 2014. All Rights Reserved.