Package org.apache.ignite.cache
Class QueryEntity
- java.lang.Object
- 
- org.apache.ignite.cache.QueryEntity
 
- 
- All Implemented Interfaces:
- Serializable
 
 public class QueryEntity extends Object implements Serializable Query entity is a description ofcacheentry (composed of key and value) in a way of how it must be indexed and can be queried.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description QueryEntity()Creates an empty query entity.QueryEntity(Class<?> keyCls, Class<?> valCls)Creates a query entity with the given key and value types.QueryEntity(String keyType, String valType)Creates a query entity with the given key and value types.QueryEntity(QueryEntity other)Copy constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryEntityaddQueryField(String fullName, String type, String alias)Utility method for building query entities programmatically.booleanequals(Object o)StringfindKeyType()Attempts to get key type from fields in case it was not set directly.StringfindValueType()Attempts to get value type from fields in case it was not set directly.Map<String,String>getAliases()Gets aliases map.Map<String,Object>getDefaultFieldValues()Gets fields default values.LinkedHashMap<String,String>getFields()Gets query fields for this query pair.Map<String,Integer>getFieldsPrecision()Map<String,Integer>getFieldsScale()@NotNull Collection<QueryIndex>getIndexes()Gets a collection of index entities.StringgetKeyFieldName()Gets key field name.Set<String>getKeyFields()Gets query fields for this query pair that belongs to the key.StringgetKeyType()Gets key type for this query pair.@Nullable Set<String>getNotNullFields()Gets names of fields that must be checked for null.StringgetTableName()Gets table name for this query entity.StringgetValueFieldName()Get value field name.StringgetValueType()Gets value type for this query pair.inthashCode()@NotNull QueryEntityPatchmakePatch(QueryEntity target)Make query entity patch.QueryEntitysetAliases(Map<String,String> aliases)Sets mapping from full property name in dot notation to an alias that will be used as SQL column name.QueryEntitysetDefaultFieldValues(Map<String,Object> defaultFieldValues)Sets fields default values.QueryEntitysetFields(LinkedHashMap<String,String> fields)Sets query fields for this query pair.QueryEntitysetFieldsPrecision(Map<String,Integer> fieldsPrecision)Sets fieldsPrecision map for a fields.QueryEntitysetFieldsScale(Map<String,Integer> fieldsScale)Sets fieldsScale map for a fields.QueryEntitysetIndexes(Collection<QueryIndex> idxs)Sets a collection of index entities.QueryEntitysetKeyFieldName(String keyFieldName)Sets key field name.QueryEntitysetKeyFields(Set<String> keyFields)Gets query fields for this query pair that belongs to the key.QueryEntitysetKeyType(String keyType)Sets key type for this query pair.QueryEntitysetNotNullFields(@Nullable Set<String> notNullFields)Sets names of fields that must checked for null.QueryEntitysetTableName(String tableName)Sets table name for this query entity.QueryEntitysetValueFieldName(String valueFieldName)Sets value field name.QueryEntitysetValueType(String valType)Sets value type for this query pair.StringtoString()
 
- 
- 
- 
Constructor Detail- 
QueryEntitypublic QueryEntity() Creates an empty query entity.
 - 
QueryEntitypublic QueryEntity(QueryEntity other) Copy constructor.- Parameters:
- other- Other entity.
 
 - 
QueryEntitypublic QueryEntity(String keyType, String valType) Creates a query entity with the given key and value types.- Parameters:
- keyType- Key type.
- valType- Value type.
 
 
- 
 - 
Method Detail- 
makePatch@NotNull public @NotNull QueryEntityPatch makePatch(QueryEntity target) Make query entity patch. This patch can only add properties to entity and can't remove them. Other words, the patch will contain only add operations(e.g. add column, create index) and not remove ones.- Parameters:
- target- Query entity to which this entity should be expanded.
- Returns:
- Patch which contains operations for expanding this entity.
 
 - 
getKeyTypepublic String getKeyType() Gets key type for this query pair.- Returns:
- Key type.
 
 - 
findKeyTypepublic String findKeyType() Attempts to get key type from fields in case it was not set directly.- Returns:
- Key type.
 
 - 
setKeyTypepublic QueryEntity setKeyType(String keyType) Sets key type for this query pair.- Parameters:
- keyType- Key type.
- Returns:
- thisfor chaining.
 
 - 
getValueTypepublic String getValueType() Gets value type for this query pair.- Returns:
- Value type.
 
 - 
findValueTypepublic String findValueType() Attempts to get value type from fields in case it was not set directly.- Returns:
- Value type.
 
 - 
setValueTypepublic QueryEntity setValueType(String valType) Sets value type for this query pair.- Parameters:
- valType- Value type.
- Returns:
- thisfor chaining.
 
 - 
getFieldspublic LinkedHashMap<String,String> getFields() Gets query fields for this query pair. The order of fields is important as it defines the order of columns returned by the 'select *' queries.- Returns:
- Field-to-type map.
 
 - 
setFieldspublic QueryEntity setFields(LinkedHashMap<String,String> fields) Sets query fields for this query pair. The order if fields is important as it defines the order of columns returned by the 'select *' queries.- Parameters:
- fields- Field-to-type map.
- Returns:
- thisfor chaining.
 
 - 
getKeyFieldspublic Set<String> getKeyFields() Gets query fields for this query pair that belongs to the key. We need this for the cases when no key-value classes are present on cluster nodes, and we need to build/modify keys and values during SQL DML operations. Thus, setting this parameter in XML is not mandatory and should be based on particular use case.- Returns:
- Set of names of key fields.
 
 - 
setKeyFieldspublic QueryEntity setKeyFields(Set<String> keyFields) Gets query fields for this query pair that belongs to the key. We need this for the cases when no key-value classes are present on cluster nodes, and we need to build/modify keys and values during SQL DML operations. Thus, setting this parameter in XML is not mandatory and should be based on particular use case.- Parameters:
- keyFields- Set of names of key fields.
- Returns:
- thisfor chaining.
 
 - 
getKeyFieldNamepublic String getKeyFieldName() Gets key field name.- Returns:
- Key name.
 
 - 
setKeyFieldNamepublic QueryEntity setKeyFieldName(String keyFieldName) Sets key field name.- Parameters:
- keyFieldName- Key name.
- Returns:
- thisfor chaining.
 
 - 
getValueFieldNamepublic String getValueFieldName() Get value field name.- Returns:
- Value name.
 
 - 
setValueFieldNamepublic QueryEntity setValueFieldName(String valueFieldName) Sets value field name.- Parameters:
- valueFieldName- value name.
- Returns:
- thisfor chaining.
 
 - 
getIndexes@NotNull public @NotNull Collection<QueryIndex> getIndexes() Gets a collection of index entities.- Returns:
- Collection of index entities.
 
 - 
setAliasespublic QueryEntity setAliases(Map<String,String> aliases) Sets mapping from full property name in dot notation to an alias that will be used as SQL column name. Example: {"parent.name" -> "parentName"}.- Parameters:
- aliases- Aliases map.
- Returns:
- thisfor chaining.
 
 - 
setIndexespublic QueryEntity setIndexes(Collection<QueryIndex> idxs) Sets a collection of index entities.- Parameters:
- idxs- Collection of index entities.
- Returns:
- thisfor chaining.
 
 - 
getTableNamepublic String getTableName() Gets table name for this query entity.- Returns:
- table name
 
 - 
setTableNamepublic QueryEntity setTableName(String tableName) Sets table name for this query entity.- Parameters:
- tableName- table name
- Returns:
- thisfor chaining.
 
 - 
getNotNullFields@Nullable public @Nullable Set<String> getNotNullFields() Gets names of fields that must be checked for null.- Returns:
- Set of names of fields that must have non-null values.
 
 - 
setNotNullFieldspublic QueryEntity setNotNullFields(@Nullable @Nullable Set<String> notNullFields) Sets names of fields that must checked for null.- Parameters:
- notNullFields- Set of names of fields that must have non-null values.
- Returns:
- thisfor chaining.
 
 - 
getFieldsPrecisionpublic Map<String,Integer> getFieldsPrecision() - Returns:
- Precision map for a fields.
 
 - 
setFieldsPrecisionpublic QueryEntity setFieldsPrecision(Map<String,Integer> fieldsPrecision) Sets fieldsPrecision map for a fields.- Parameters:
- fieldsPrecision- Precision map for a fields.
- Returns:
- Thisfor chaining.
 
 - 
setFieldsScalepublic QueryEntity setFieldsScale(Map<String,Integer> fieldsScale) Sets fieldsScale map for a fields.- Parameters:
- fieldsScale- Scale map for a fields.
- Returns:
- Thisfor chaining.
 
 - 
getDefaultFieldValuespublic Map<String,Object> getDefaultFieldValues() Gets fields default values.- Returns:
- Field's name to default value map.
 
 - 
setDefaultFieldValuespublic QueryEntity setDefaultFieldValues(Map<String,Object> defaultFieldValues) Sets fields default values.- Parameters:
- defaultFieldValues- Field's name to default value map.
- Returns:
- thisfor chaining.
 
 - 
addQueryFieldpublic QueryEntity addQueryField(String fullName, String type, String alias) Utility method for building query entities programmatically.- Parameters:
- fullName- Full name of the field.
- type- Type of the field.
- alias- Field alias.
- Returns:
- thisfor chaining.
 
 
- 
 
-