org.apache.cayenne.exp.property

## 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 and Description
    --- | ---
    `protected Class<V>` | `entityType`
    `protected Class<K>` | `keyType`

    - ### Fields inherited from class org.apache.cayenne.exp.property.BaseProperty

      `expressionSupplier, name, type`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MapProperty<K,V>` | `alias(String alias)` Creates alias with different name for this property
    `Expression` | `contains(Collection<V> values)`
    `Expression` | `contains(V value)`
    `Expression` | `contains(V firstValue, V... moreValues)`
    `Expression` | `containsId(Collection<Object> ids)`
    `Expression` | `containsId(Object id)`
    `Expression` | `containsId(Object firstId, Object... moreId)`
    `MapProperty<K,V>` | `enclosing()`
    `EntityProperty<V>` | `flat()` Create new "flat" property for toMany relationship.
    `protected Class<V>` | `getEntityType()`
    `protected Class<K>` | `getKeyType()`
    `Expression` | `notContains(Collection<V> values)`
    `Expression` | `notContains(V value)`
    `Expression` | `notContains(V firstValue, V... moreValues)`
    `Expression` | `notContainsId(Collection<Object> ids)`
    `Expression` | `notContainsId(Object id)`
    `Expression` | `notContainsId(Object firstId, Object... moreId)`
    `MapProperty<K,V>` | `outer()` Returns a version of this property that represents an OUTER join.

    - ### Methods inherited from class org.apache.cayenne.exp.property.BaseProperty

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

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

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

    - ### Methods inherited from interface org.apache.cayenne.exp.property.RelationshipProperty

      `disjoint, disjointById, dot, dot, dot, dot, dot, dot, dot, joint`

    - ### Methods inherited from interface org.apache.cayenne.exp.property.PathProperty

      `dot, dot, dot, dot, dot`

    - ### Methods inherited from interface org.apache.cayenne.exp.property.Property

      `getAlias, getExpression, getName, getType`

- - ### Field Detail

    - #### keyType

          protected Class<K> keyType

    - #### entityType

          protected Class<V extends Persistent> entityType

  - ### Constructor Detail

    - #### MapProperty

          protected MapProperty(String name,
                                Expression expression,
                                Class<K> keyType,
                                Class<V> entityType)

      Constructs a new property with the given name and expression
      Parameters:
        `name` - 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 Detail

    - #### 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

          @SafeVarargs
          public final Expression contains(V firstValue,
                                                         V... moreValues)

      Returns:
        An expression for finding objects with values in the given set.

    - #### contains

          public Expression contains(Collection<V> values)

      Returns:
        An expression for finding objects with values in the given set.

    - #### notContains

          public Expression notContains(Collection<V> values)

      Returns:
        An expression for finding objects with values not in the given set.

    - #### notContains

          @SafeVarargs
          public final Expression notContains(V firstValue,
                                                            V... moreValues)

      Returns:
        An expression for finding objects with values not in the given set.

    - #### containsId

          public Expression containsId(Object id)

      Parameters:
        `id` - object id
      Returns:
        An expression for finding object with given id.

    - #### containsId

          public Expression containsId(Object firstId,
                                       Object... moreId)

      Returns:
        An expression for finding objects with given id set

    - #### containsId

          public Expression containsId(Collection<Object> ids)

      Returns:
        An expression for finding objects with given id set.

    - #### notContainsId

          public Expression notContainsId(Object id)

      Parameters:
        `id` - object id
      Returns:
        An expression for finding object without given id.

    - #### notContainsId

          public Expression notContainsId(Object firstId,
                                          Object... moreId)

      Returns:
        An expression for finding objects without given id set.

    - #### notContainsId

          public Expression notContainsId(Collection<Object> ids)

      Returns:
        An expression for finding objects without given id set.

    - #### 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. It is up to caller to ensure that the property corresponds to a relationship, as "outer" attributes make no sense.
      Specified by:
        `outer` in interface `RelationshipProperty<Map<K,V extends Persistent>>`

    - #### 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()

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

Copyright © 2001–2021 Apache Cayenne. All rights reserved.