com.hazelcast.config

## Class MapIndexConfig

- java.lang.Object
- - com.hazelcast.config.MapIndexConfig

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable
  Direct Known Subclasses:
    MapIndexConfigReadOnly

      public class MapIndexConfig
      extends Object
      implements IdentifiedDataSerializable

  Contains the configuration for an index in a map. This class should be used in combination with the `MapConfig`. The reason to create an map index is to speed up searches for particular map entries.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapIndexConfig()` Creates a MapIndexConfig without an attribute and with ordered set to `false`.
    `MapIndexConfig(MapIndexConfig config)`
    `MapIndexConfig(String attribute, boolean ordered)` Creates a MapIndexConfig with the given attribute and ordered setting.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `MapIndexConfigReadOnly` | `getAsReadOnly()` Deprecated. this method will be removed in 4.0; it is meant for internal usage only
    `String` | `getAttribute()` Gets the attribute that is going to be indexed.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `int` | `hashCode()`
    `boolean` | `isOrdered()` Checks if the index should be ordered.
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `MapIndexConfig` | `setAttribute(String attribute)` Sets the attribute that is going to be indexed.
    `MapIndexConfig` | `setOrdered(boolean ordered)` Configures the index to be ordered or not ordered.
    `String` | `toString()`
    `static String` | `validateIndexAttribute(String attribute)` Validates index attribute content.
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MapIndexConfig

          public MapIndexConfig()

      Creates a MapIndexConfig without an attribute and with ordered set to `false`.

    - #### MapIndexConfig

          public MapIndexConfig(String attribute,
                                boolean ordered)

      Creates a MapIndexConfig with the given attribute and ordered setting.
      Parameters:
        `attribute` - the attribute that is going to be indexed
        `ordered` - `true` if the index is ordered, `false` otherwise
      See Also:
        `setOrdered(boolean)`, `setAttribute(String)`

    - #### MapIndexConfig

          public MapIndexConfig(MapIndexConfig config)

  - ### Method Detail

    - #### getAsReadOnly

          public MapIndexConfigReadOnly getAsReadOnly()

      Deprecated. this method will be removed in 4.0; it is meant for internal usage only
      Gets immutable version of this configuration.
      Returns:
        immutable version of this configuration

    - #### getAttribute

          public String getAttribute()

      Gets the attribute that is going to be indexed. If no attribute is set, `null` is returned.
      Returns:
        the attribute to be indexed
      See Also:
        `setAttribute(String)`

    - #### setAttribute

          public MapIndexConfig setAttribute(String attribute)

      Sets the attribute that is going to be indexed.
      Parameters:
        `attribute` - the attribute that is going to be indexed
      Returns:
        the updated MapIndexConfig
      Throws:
        `IllegalArgumentException` - if attribute is null or an empty string

    - #### isOrdered

          public boolean isOrdered()

      Checks if the index should be ordered.
      Returns:
        `true` if ordered, `false` otherwise
      See Also:
        `setOrdered(boolean)`

    - #### setOrdered

          public MapIndexConfig setOrdered(boolean ordered)

      Configures the index to be ordered or not ordered. Some indices can be ordered, such as age. Sometimes you want to look for all people with an age equal or greater than X. In other cases an ordered index doesn't make sense, such as a phone number for a person.
      Parameters:
        `ordered` - if the index should be an ordered index
      Returns:
        the updated MapIndexConfig

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### validateIndexAttribute

          public static String validateIndexAttribute(String attribute)

      Validates index attribute content.
      Parameters:
        `attribute` - attribute to validate
      Returns:
        the attribute for fluent assignment

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2020. All rights reserved.