# Class MapProperty<K, V extends Persistent>

java.lang.Object
org.apache.cayenne.exp.property.BaseProperty<Map<K,V>>
org.apache.cayenne.exp.property.MapProperty<K,V>

All Implemented Interfaces:
  `PathProperty<Map<K,V>>, Property<Map<K,V>>, RelationshipProperty<Map<K,V>>`

public class MapProperty<K, V extends Persistent> extends BaseProperty<Map<K,V>> implements RelationshipProperty<Map<K,V>>
Property that represents to-many relationship mapped on `Map`.

Since:
  4.2
See Also:
  - `org.apache.cayenne.exp.property`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Class<V>`
  `entityType`
  `protected Class<K>`
  `keyType`

  ### Fields inherited from class BaseProperty

  `expressionSupplier, path, type`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `MapProperty(CayennePath path, Expression expression, Class<K> keyType, Class<V> entityType)`
  Constructs a new property with the given path and expression

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MapProperty<K,V>`
  `alias(String alias)`
  Creates alias with different name for this property
  `Expression`
  `contains(Collection<V> values)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `containsValuesCollection(Collection)`
  `Expression`
  `contains(V value)`
  `final Expression`
  `contains(V firstValue, V... moreValues)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `containsValues(V...)`
  `Expression`
  `containsId(Object id)`
  `Expression`
  `containsId(Object firstId, Object... moreId)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `containsIds(Object...)`
  `Expression`
  `containsId(Collection<Object> ids)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `containsIdsCollection(Collection)`
  `Expression`
  `containsIds(Object... ids)`
  `Expression`
  `containsIdsCollection(Collection<?> ids)`
  `final Expression`
  `containsValues(V... values)`
  `Expression`
  `containsValuesCollection(Collection<V> values)`
  `MapProperty<K,V>`
  `enclosing()`
  This operator allows to access properties of the enclosing query from the subquery.
  `EntityProperty<V>`
  `flat()`
  Create new "flat" property for toMany relationship.
  `protected Class<V>`
  `getEntityType()`
  `protected Class<K>`
  `getKeyType()`
  `Expression`
  `notContains(Collection<V> values)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `notContainsValuesCollection(Collection)`
  `Expression`
  `notContains(V value)`
  `final Expression`
  `notContains(V firstValue, V... moreValues)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `notContainsValues(V...)`
  `Expression`
  `notContainsId(Object id)`
  `Expression`
  `notContainsId(Object firstId, Object... moreId)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `notContainsIds(Object...)`
  `Expression`
  `notContainsId(Collection<Object> ids)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `notContainsIdsCollection(Collection)`
  `Expression`
  `notContainsIds(Object... ids)`
  `Expression`
  `notContainsIdsCollection(Collection<?> ids)`
  `final Expression`
  `notContainsValues(V... values)`
  `Expression`
  `notContainsValuesCollection(Collection<V> values)`
  `MapProperty<K,V>`
  `outer()`
  Returns a version of this property that represents an OUTER join.

  ### Methods inherited from class BaseProperty

  `aggregate, asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, eq, eq, equals, function, function, getAlias, getExpression, getFrom, getFromAll, getName, getPath, getType, hashCode, in, in, in, isFalse, isNotNull, isNull, isTrue, ne, ne, nin, nin, nin, operator, operator, setIn, setInAll`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface PathProperty

  `dot, dot, dot, dot, dot`

  ### Methods inherited from interface Property

  `getAlias, getExpression, getName, getPath, getType`

  ### Methods inherited from interface RelationshipProperty

  `disjoint, disjointById, dot, dot, dot, dot, dot, dot, dot, exists, joint, notExists`

- ## Field Details

  - ### keyType

    protected Class<K> keyType

  - ### entityType

    protected Class<V extends Persistent> entityType

- ## Constructor Details

  - ### MapProperty

    protected MapProperty(CayennePath path, Expression expression, Class<K> keyType, Class<V> entityType)
    Constructs a new property with the given path and expression
    Parameters:
      `path` - of the property (will be used as alias for the expression)
      `expression` - expression for property
      `keyType` - type of keys of the property
      `entityType` - type of related entities
    See Also:
      - `PropertyFactory.createMap(String, Expression, Class, Class)`

- ## Method Details

  - ### flat

    public EntityProperty<V> flat()

    Create new "flat" property for toMany relationship.

    Example:

            List<Object[]> result = ObjectSelect
                 .columnQuery(Artist.class, Artist.ARTIST_NAME, Artist.PAINTING_ARRAY.flat(Painting.class))
                 .select(context);

  - ### contains

    public Expression contains(V value)
    Returns:
      An expression representing equality to a value.

  - ### notContains

    public Expression notContains(V value)
    Returns:
      An expression representing inequality to a value.

  - ### contains

    @Deprecated(since="5.0", forRemoval=true) @SafeVarargs public final Expression contains(V firstValue, V... moreValues)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `containsValues(V...)`
    Returns:
      An expression for finding objects with values in the given set.

  - ### containsValues

    @SafeVarargs public final Expression containsValues(V... values)
    Returns:
      An expression for finding objects with values in the given set.
    Since:
      5.0

  - ### contains

    @Deprecated(since="5.0", forRemoval=true) public Expression contains(Collection<V> values)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `containsValuesCollection(Collection)`
    Returns:
      An expression for finding objects with values in the given set.

  - ### containsValuesCollection

    public Expression containsValuesCollection(Collection<V> values)
    Returns:
      An expression for finding objects with values in the given set.
    Since:
      5.0

  - ### notContains

    @Deprecated(since="5.0", forRemoval=true) public Expression notContains(Collection<V> values)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `notContainsValuesCollection(Collection)`
    Returns:
      An expression for finding objects with values not in the given set.

  - ### notContainsValuesCollection

    public Expression notContainsValuesCollection(Collection<V> values)
    Returns:
      An expression for finding objects with values in the given set.
    Since:
      5.0

  - ### notContains

    @Deprecated(since="5.0", forRemoval=true) @SafeVarargs public final Expression notContains(V firstValue, V... moreValues)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `notContainsValues(V...)`
    Returns:
      An expression for finding objects with values not in the given set.

  - ### notContainsValues

    @SafeVarargs public final Expression notContainsValues(V... values)
    Returns:
      An expression for finding objects with values not in the given set.
    Since:
      5.0

  - ### containsId

    public Expression containsId(Object id)
    Parameters:
      `id` - object id
    Returns:
      An expression for finding object with given id.

  - ### containsId

    @Deprecated(since="5.0", forRemoval=true) public Expression containsId(Object firstId, Object... moreId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `containsIds(Object...)`
    Returns:
      An expression for finding objects with given id set

  - ### containsIds

    public Expression containsIds(Object... ids)
    Returns:
      An expression for finding objects with given id set
    Since:
      5.0

  - ### containsId

    @Deprecated(since="5.0", forRemoval=true) public Expression containsId(Collection<Object> ids)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `containsIdsCollection(Collection)`
    Returns:
      An expression for finding objects with given id set.

  - ### containsIdsCollection

    public Expression containsIdsCollection(Collection<?> ids)
    Returns:
      An expression for finding objects with given id set.
    Since:
      5.0

  - ### notContainsId

    public Expression notContainsId(Object id)
    Parameters:
      `id` - object id
    Returns:
      An expression for finding object without given id.

  - ### notContainsId

    @Deprecated(since="5.0", forRemoval=true) public Expression notContainsId(Object firstId, Object... moreId)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `notContainsIds(Object...)`
    Returns:
      An expression for finding objects without given id set.

  - ### notContainsIds

    public Expression notContainsIds(Object... ids)
    Returns:
      An expression for finding objects without given id set.
    Since:
      5.0

  - ### notContainsId

    @Deprecated(since="5.0", forRemoval=true) public Expression notContainsId(Collection<Object> ids)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `notContainsIdsCollection(Collection)`
    Returns:
      An expression for finding objects without given id set.

  - ### notContainsIdsCollection

    public Expression notContainsIdsCollection(Collection<?> ids)
    Returns:
      An expression for finding objects without given id set.
    Since:
      5.0

  - ### alias

    public MapProperty<K,V> alias(String alias)
    Creates alias with different name for this property
    Overrides:
      `alias` in class `BaseProperty<Map<K, V extends Persistent>>`

  - ### outer

    public MapProperty<K,V> outer()
    Returns a version of this property that represents an OUTER join.
    Specified by:
      `outer` in interface `RelationshipProperty<K>`

  - ### getKeyType

    protected Class<K> getKeyType()
    Returns:
      type of keys in represented attribute

  - ### getEntityType

    protected Class<V> getEntityType()
    Returns:
      type of object entity in represented attribute

  - ### enclosing

    public MapProperty<K,V> enclosing()
    Description copied from class: `BaseProperty`
    This operator allows to access properties of the enclosing query from the subquery. It allows multiple nesting levels to access a corresponding query in case of multiple levels of subqueries. Example:

        ObjectSelect.query(Artist.class)
                        .where(ExpressionFactory.notExists(ObjectSelect.query(Painting.class)
                                .where(Painting.TO_ARTIST.eq(Artist.ARTIST_ID_PK_PROPERTY.enclosing()))))

    Overrides:
      `enclosing` in class `BaseProperty<Map<K, V extends Persistent>>`
    Returns:
      property that will be translated relative to parent query