org.apache.ignite.internal.processors.query

## Class QueryTypeDescriptorImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl

All Implemented Interfaces:
  GridQueryTypeDescriptor

    public class QueryTypeDescriptorImpl
    extends Object
    implements GridQueryTypeDescriptor

Descriptor of type.

### Constructor Summary

Constructors
Constructor and Description
`QueryTypeDescriptorImpl(String space)` Constructor.

### Method Summary

Methods
`void` `addFieldToTextIndex(String field)` Adds field to text index.
`void` `addIndex(QueryIndexDescriptorImpl idx)` Add index.
`void` `addProperty(GridQueryProperty prop, boolean failOnDuplicate)` Adds property to the type descriptor.
`String` `affinityKey()` Returns affinity key field name or `null` for default.
`void` `affinityKey(String affKey)`
`Map<String,String>` `aliases()`
`void` `aliases(Map<String,String> aliases)`
`void` `dropIndex(String idxName)` Drop index.
`Map<String,Class<?>>` `fields()` Gets mapping from field name to its type.
`boolean` `hasField(String field)` Chedk if particular field exists.
`QueryIndexDescriptorImpl` `index(String name)` Get index by name.
`Map<String,GridQueryIndexDescriptor>` `indexes()` Gets indexes for this type.
`Collection<QueryIndexDescriptorImpl>` `indexes0()`
`Class<?>` `keyClass()` Gets key class.
`void` `keyClass(Class<?> keyCls)` Set key class.
`String` `keyFieldName()` Gets key field name.
`void` `keyFieldName(String keyFieldName)` Sets key field name.
`String` `keyTypeName()` Gets key type name.
`void` `keyTypeName(String keyTypeName)` Set key type name.
`void` `markObsolete()` Mark index as obsolete.
`String` `name()` Gets type name which uniquely identifies this type.
`void` `name(String name)` Sets type name.
`boolean` `obsolete()`
`Map<String,GridQueryProperty>` `properties()`
`GridQueryProperty` `property(String name)`
`void` `setValue(String field, Object key, Object val, Object propVal)` Sets field value for given key and value.
`String` `space()`
`String` `tableName()` Gets table name for type.
`void` `tableName(String tblName)` Sets table name for type.
`GridQueryIndexDescriptor` `textIndex()` Get text index for this type (if any).
`String` `toString()`
`int` `typeId()`
`void` `typeId(int typeId)`
`<T> T` `value(String field, Object key, Object val)` Gets field value for given key and value.
`Class<?>` `valueClass()` Gets value class.
`void` `valueClass(Class<?> valCls)` Sets value class.
`String` `valueFieldName()` Gets value field name.
`void` `valueFieldName(String valueFieldName)` Sets value field name.
`boolean` `valueTextIndex()` Returns `true` if string representation of value should be indexed as text.
`void` `valueTextIndex(boolean valTextIdx)` Sets if this value should be text indexed.
`String` `valueTypeName()` Gets value type name.
`void` `valueTypeName(String valTypeName)` Set value type name.

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

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

### Constructor Detail

#### QueryTypeDescriptorImpl

    public QueryTypeDescriptorImpl(String space)

Constructor.

Parameters:
  `space` - Cache name.

### Method Detail

#### space

    public String space()

Returns:
  Space.

#### name

    public String name()

Gets type name which uniquely identifies this type.

Specified by:
  `name` in interface `GridQueryTypeDescriptor`
Returns:
  Type name which uniquely identifies this type.

#### name

    public void name(String name)

Sets type name.

Parameters:
  `name` - Name.

#### tableName

    public String tableName()

Gets table name for type.

Specified by:
  `tableName` in interface `GridQueryTypeDescriptor`
Returns:
  Table name.

#### tableName

    public void tableName(String tblName)

Sets table name for type.

Parameters:
  `tblName` - Table name.

#### fields

    public Map<String,Class<?>> fields()

Gets mapping from field name to its type.

Specified by:
  `fields` in interface `GridQueryTypeDescriptor`
Returns:
  Fields that can be indexed, participate in queries and can be queried using method.

#### property

    public GridQueryProperty property(String name)

Specified by:
  `property` in interface `GridQueryTypeDescriptor`
Parameters:
  `name` - Property name.
Returns:
  Property.

#### properties

    public Map<String,GridQueryProperty> properties()

Returns:
  Properties.

#### value

    public <T> T value(String field,
              Object key,
              Object val)
            throws IgniteCheckedException

Gets field value for given key and value.

Specified by:
  `value` in interface `GridQueryTypeDescriptor`
Parameters:
  `field` - Field name.
  `key` - Key.
  `val` - Value.
Returns:
  Value for given field.
Throws:
  `IgniteCheckedException` - If failed.

#### setValue

    public void setValue(String field,
                Object key,
                Object val,
                Object propVal)
                  throws IgniteCheckedException

Sets field value for given key and value.

Specified by:
  `setValue` in interface `GridQueryTypeDescriptor`
Parameters:
  `field` - Field name.
  `key` - Key.
  `val` - Value.
  `propVal` - Value for given field.
Throws:
  `IgniteCheckedException` - If failed.

#### indexes

    public Map<String,GridQueryIndexDescriptor> indexes()

Gets indexes for this type.

Specified by:
  `indexes` in interface `GridQueryTypeDescriptor`
Returns:
  Indexes for this type.

#### typeId

    public int typeId()

Specified by:
  `typeId` in interface `GridQueryTypeDescriptor`
Returns:
  BinaryObject's type ID if indexed value is BinaryObject, otherwise value class' hash code.

#### typeId

    public void typeId(int typeId)

Parameters:
  `typeId` - Type ID.

#### index

    @Nullable
    public QueryIndexDescriptorImpl index(String name)

Get index by name.

Parameters:
  `name` - Name.
Returns:
  Index.

#### indexes0

    public Collection<QueryIndexDescriptorImpl> indexes0()

Returns:
  Raw index descriptors.

#### textIndex

    public GridQueryIndexDescriptor textIndex()

Get text index for this type (if any).

Specified by:
  `textIndex` in interface `GridQueryTypeDescriptor`
Returns:
  Text index or `null`.

#### addIndex

    public void addIndex(QueryIndexDescriptorImpl idx)
                  throws IgniteCheckedException

Add index.

Parameters:
  `idx` - Index.
Throws:
  `IgniteCheckedException` - If failed.

#### dropIndex

    public void dropIndex(String idxName)

Drop index.

Parameters:
  `idxName` - Index name.

#### hasField

    public boolean hasField(String field)

Chedk if particular field exists.

Parameters:
  `field` - Field.
Returns:
  `True` if exists.

#### addFieldToTextIndex

    public void addFieldToTextIndex(String field)
                             throws IgniteCheckedException

Adds field to text index.

Parameters:
  `field` - Field name.
Throws:
  `IgniteCheckedException` - If failed.

#### valueClass

    public Class<?> valueClass()

Gets value class.

Specified by:
  `valueClass` in interface `GridQueryTypeDescriptor`
Returns:
  Value class.

#### valueClass

    public void valueClass(Class<?> valCls)

Sets value class.

Parameters:
  `valCls` - Value class.

#### keyClass

    public Class<?> keyClass()

Gets key class.

Specified by:
  `keyClass` in interface `GridQueryTypeDescriptor`
Returns:
  Key class.

#### keyClass

    public void keyClass(Class<?> keyCls)

Set key class.

Parameters:
  `keyCls` - Key class.

#### keyTypeName

    public String keyTypeName()

Gets key type name.

Specified by:
  `keyTypeName` in interface `GridQueryTypeDescriptor`
Returns:
  Key type name.

#### keyTypeName

    public void keyTypeName(String keyTypeName)

Set key type name.

Parameters:
  `keyTypeName` - Key type name.

#### valueTypeName

    public String valueTypeName()

Gets value type name.

Specified by:
  `valueTypeName` in interface `GridQueryTypeDescriptor`
Returns:
  Value type name.

#### valueTypeName

    public void valueTypeName(String valTypeName)

Set value type name.

Parameters:
  `valTypeName` - Value type name.

#### addProperty

    public void addProperty(GridQueryProperty prop,
                   boolean failOnDuplicate)
                     throws IgniteCheckedException

Adds property to the type descriptor.

Parameters:
  `prop` - Property.
  `failOnDuplicate` - Fail on duplicate flag.
Throws:
  `IgniteCheckedException` - In case of error.

#### valueTextIndex

    public boolean valueTextIndex()

Returns `true` if string representation of value should be indexed as text.

Specified by:
  `valueTextIndex` in interface `GridQueryTypeDescriptor`
Returns:
  If string representation of value should be full-text indexed.

#### valueTextIndex

    public void valueTextIndex(boolean valTextIdx)

Sets if this value should be text indexed.

Parameters:
  `valTextIdx` - Flag value.

#### affinityKey

    public String affinityKey()

Returns affinity key field name or `null` for default.

Specified by:
  `affinityKey` in interface `GridQueryTypeDescriptor`
Returns:
  Affinity key.

#### affinityKey

    public void affinityKey(String affKey)

Parameters:
  `affKey` - Affinity key field.

#### aliases

    public Map<String,String> aliases()

Returns:
  Aliases.

#### aliases

    public void aliases(Map<String,String> aliases)

Parameters:
  `aliases` - Aliases.

#### obsolete

    public boolean obsolete()

Returns:
  `True` if obsolete.

#### markObsolete

    public void markObsolete()

Mark index as obsolete.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### keyFieldName

    public void keyFieldName(String keyFieldName)

Sets key field name.

Parameters:
  `keyFieldName` - Key field name.

#### keyFieldName

    public String keyFieldName()

Gets key field name.

Specified by:
  `keyFieldName` in interface `GridQueryTypeDescriptor`
Returns:
  Key field name.

#### valueFieldName

    public void valueFieldName(String valueFieldName)

Sets value field name.

Parameters:
  `valueFieldName` - value field name.

#### valueFieldName

    public String valueFieldName()

Gets value field name.

Specified by:
  `valueFieldName` in interface `GridQueryTypeDescriptor`
Returns:
  value field name.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017