# Class CollectionProperty<V extends Persistent, E extends Collection<V>>

java.lang.Object
org.apache.cayenne.exp.property.BaseProperty<E>
org.apache.cayenne.exp.property.CollectionProperty<V,E>

All Implemented Interfaces:
  `PathProperty<E>, Property<E>, RelationshipProperty<E>`

Direct Known Subclasses:
  `ListProperty, SetProperty`

public abstract class CollectionProperty<V extends Persistent, E extends Collection<V>> extends BaseProperty<E> implements RelationshipProperty<E>
Base class for `ListProperty` and `SetProperty`

Since:
  4.2

- ## Field Summary

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

  ### Fields inherited from class BaseProperty

  `expressionSupplier, path, type`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CollectionProperty(CayennePath path, Expression expression, Class<? super E> collectionType, Class<V> entityType)`
  Constructs a new property with the given name and expression

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `containsValue(V)`
  `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)`
  `Expression`
  `containsValue(V value)`
  `final Expression`
  `containsValues(V... values)`
  `Expression`
  `containsValuesCollection(Collection<V> values)`
  `EntityProperty<V>`
  `flat()`
  Create new "flat" property for toMany relationship.
  `protected Class<V>`
  `getEntityType()`
  `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)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favour of `notContainsValue(V)`
  `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)`
  `Expression`
  `notContainsValue(V value)`
  `final Expression`
  `notContainsValues(V... values)`
  `Expression`
  `notContainsValuesCollection(Collection<V> values)`

  ### Methods inherited from class BaseProperty

  `aggregate, alias, asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, enclosing, 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, outer`

- ## Field Details

  - ### entityType

    protected Class<V extends Persistent> entityType

- ## Constructor Details

  - ### CollectionProperty

    protected CollectionProperty(CayennePath path, Expression expression, Class<? super E> collectionType, Class<V> entityType)
    Constructs a new property with the given name and expression
    Parameters:
      `path` - of the property (will be used as alias for the expression)
      `expression` - expression for property
      `collectionType` - type of the collection
      `entityType` - type of related entity

- ## 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())
             .select(context);

  - ### contains

    @Deprecated(since="5.0", forRemoval=true) public Expression contains(V value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `containsValue(V)`
    Returns:
      An expression representing equality to a value.

  - ### notContains

    @Deprecated(since="5.0", forRemoval=true) public Expression notContains(V value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favour of `notContainsValue(V)`
    Returns:
      An expression representing equality to a value.

  - ### contains

    @Deprecated(since="5.0", forRemoval=true) public 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.

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

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

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

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

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

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

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

  - ### containsValue

    public Expression containsValue(V value)
    Returns:
      An expression representing equality to a value.
    Since:
      5.0

  - ### notContainsValue

    public Expression notContainsValue(V value)
    Returns:
      An expression representing inequality to a value.
    Since:
      5.0

  - ### containsValues

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

  - ### containsValuesCollection

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

  - ### containsIds

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

  - ### containsIdsCollection

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

  - ### notContainsIds

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

  - ### notContainsIdsCollection

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

  - ### notContainsValuesCollection

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

  - ### notContainsValues

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

  - ### getEntityType

    protected Class<V> getEntityType()
    Returns:
      object entity type represented by this property