# Class BaseProperty<E>

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

All Implemented Interfaces:
  `Property<E>`

Direct Known Subclasses:
  `BaseIdProperty, CollectionProperty, DateProperty, EmbeddableProperty, EntityProperty, MapProperty, NumericProperty, StringProperty`

public class BaseProperty<E> extends Object implements Property<E>
Property that represents generic attribute.

Provides equality checks and sorting API along with some utility methods.

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Supplier<Expression>`
  `expressionSupplier`
  Expression provider for the property
  `protected final CayennePath`
  `path`
  Path of this property
  `protected final Class<E>`
  `type`
  Explicit type of the property

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> BaseProperty<T>`
  `aggregate(String function, Class<T> type)`
  `BaseProperty<E>`
  `alias(String alias)`
  Creates alias with different name for this property
  `Ordering`
  `asc()`
  `Ordering`
  `ascInsensitive()`
  `Orderings`
  `ascInsensitives()`
  `Orderings`
  `ascs()`
  `NumericProperty<Long>`
  `count()`
  `NumericProperty<Long>`
  `countDistinct()`
  `Ordering`
  `desc()`
  `Ordering`
  `descInsensitive()`
  `Orderings`
  `descInsensitives()`
  `Orderings`
  `descs()`
  `BaseProperty<E>`
  `enclosing()`
  This operator allows to access properties of the enclosing query from the subquery.
  `Expression`
  `eq(E value)`
  `Expression`
  `eq(BaseProperty<?> value)`
  `boolean`
  `equals(Object o)`
  `<T> BaseProperty<T>`
  `function(String functionName, Class<T> returnType, Object... arguments)`
  `<T> BaseProperty<T>`
  `function(String functionName, Class<T> returnType, BaseProperty<?>... arguments)`
  `String`
  `getAlias()`
  `Expression`
  `getExpression()`
  This method returns fresh copy of the expression for each call.
  `E`
  `getFrom(Object bean)`
  Extracts property value from an object using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.
  `List<E>`
  `getFromAll(Collection<?> beans)`
  Extracts property value from a collection of objects using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.
  `String`
  `getName()`
  `CayennePath`
  `getPath()`
  `Class<E>`
  `getType()`
  `int`
  `hashCode()`
  `Expression`
  `in(E firstValue, E... moreValues)`
  `Expression`
  `in(Collection<E> values)`
  `Expression`
  `in(ColumnSelect<? extends E> subquery)`
  `Expression`
  `isFalse()`
  `Expression`
  `isNotNull()`
  `Expression`
  `isNull()`
  `Expression`
  `isTrue()`
  `Expression`
  `ne(E value)`
  `Expression`
  `ne(BaseProperty<?> value)`
  `Expression`
  `nin(E firstValue, E... moreValues)`
  `Expression`
  `nin(Collection<E> values)`
  `Expression`
  `nin(ColumnSelect<? extends E> subquery)`
  `<T> BaseProperty<T>`
  `operator(String operator, Class<T> returnType, Object... arguments)`
  `<T> BaseProperty<T>`
  `operator(String operator, Class<T> returnType, BaseProperty<?>... arguments)`
  `void`
  `setIn(Object bean, E value)`
  Sets a property value in 'obj' using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.
  `void`
  `setInAll(Collection<?> beans, E value)`
  Sets a property value in a collection of objects using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### path

    protected final CayennePath path
    Path of this property

  - ### expressionSupplier

    protected final Supplier<Expression> expressionSupplier
    Expression provider for the property

  - ### type

    protected final Class<E> type
    Explicit type of the property

- ## Constructor Details

  - ### BaseProperty

    protected BaseProperty(CayennePath path, Expression expression, Class<? super E> type)
    Constructs a new property with the given name and expression
    Parameters:
      `path` - path value of the property (will be used as alias for the expression)
      `expression` - expression for property
      `type` - of the property
    See Also:
      - `PropertyFactory.createBase(String, Expression, Class)`

- ## Method Details

  - ### getName

    public String getName()
    Specified by:
      `getName` in interface `Property<E>`
    Returns:
      Name of the property in the object.
    See Also:
      - `Property.getPath()`

  - ### getPath

    public CayennePath getPath()
    Specified by:
      `getPath` in interface `Property<E>`
    Returns:
      path this property represents
    Since:
      5.0
    See Also:
      - `Property.getName()`

  - ### getAlias

    public String getAlias()
    Specified by:
      `getAlias` in interface `Property<E>`
    Returns:
      alias for this property

  - ### getExpression

    public Expression getExpression()
    This method returns fresh copy of the expression for each call.
    Specified by:
      `getExpression` in interface `Property<E>`
    Returns:
      expression that represents this Property

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### isNull

    public Expression isNull()
    Returns:
      An expression representing null.

  - ### isNotNull

    public Expression isNotNull()
    Returns:
      An expression representing a non-null value.

  - ### asc

    public Ordering asc()
    Returns:
      Ascending sort orderings on this property.

  - ### ascs

    public Orderings ascs()
    Returns:
      Ascending sort orderings on this property.

  - ### ascInsensitive

    public Ordering ascInsensitive()
    Returns:
      Ascending case-insensitive sort orderings on this property.

  - ### ascInsensitives

    public Orderings ascInsensitives()
    Returns:
      Ascending case-insensitive sort orderings on this property.

  - ### desc

    public Ordering desc()
    Returns:
      Descending sort orderings on this property.

  - ### descs

    public Orderings descs()
    Returns:
      Descending sort orderings on this property.

  - ### descInsensitive

    public Ordering descInsensitive()
    Returns:
      Descending case-insensitive sort orderings on this property.

  - ### descInsensitives

    public Orderings descInsensitives()
    Returns:
      Descending case-insensitive sort orderings on this property.

  - ### getFrom

    public E getFrom(Object bean)
    Extracts property value from an object using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

  - ### getFromAll

    public List<E> getFromAll(Collection<?> beans)
    Extracts property value from a collection of objects using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

  - ### setIn

    public void setIn(Object bean, E value)
    Sets a property value in 'obj' using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

  - ### setInAll

    public void setInAll(Collection<?> beans, E value)
    Sets a property value in a collection of objects using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

  - ### count

    public NumericProperty<Long> count()
    See Also:
      - `FunctionExpressionFactory.countExp(Expression)`

  - ### countDistinct

    public NumericProperty<Long> countDistinct()
    See Also:
      - `FunctionExpressionFactory.countDistinctExp(Expression)`

  - ### aggregate

    public <T> BaseProperty<T> aggregate(String function, Class<T> type)
    Since:
      5.0
    See Also:
      - `FunctionExpressionFactory.customAggregateExp(String, Expression)`

  - ### alias

    public BaseProperty<E> alias(String alias)
    Creates alias with different name for this property

  - ### getType

    public Class<E> getType()
    Specified by:
      `getType` in interface `Property<E>`
    Returns:
      type of entity attribute described by this property

  - ### isTrue

    public Expression isTrue()
    Returns:
      An expression representing equality to TRUE.

  - ### isFalse

    public Expression isFalse()
    Returns:
      An expression representing equality to FALSE.

  - ### eq

    public Expression eq(E value)
    Returns:
      An expression representing equality to a value.

  - ### eq

    public Expression eq(BaseProperty<?> value)
    Returns:
      An expression representing equality between two attributes (columns).

  - ### ne

    public Expression ne(E value)
    Returns:
      An expression representing inequality to a value.

  - ### ne

    public Expression ne(BaseProperty<?> value)
    Returns:
      An expression representing inequality between two attributes (columns).

  - ### in

    public Expression in(E firstValue, E... moreValues)
    Returns:
      An expression for finding objects with values in the given set.

  - ### nin

    public Expression nin(E firstValue, E... moreValues)
    Returns:
      An expression for finding objects with values not in the given set.

  - ### in

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

  - ### nin

    public Expression nin(Collection<E> values)
    Returns:
      An expression for finding objects with values not in the given set.

  - ### in

    public Expression in(ColumnSelect<? extends E> subquery)
    Returns:
      An expression for finding objects with values in the given subquery

  - ### nin

    public Expression nin(ColumnSelect<? extends E> subquery)
    Returns:
      An expression for finding objects with values not in the given subquery

  - ### enclosing

    public BaseProperty<E> enclosing()
    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()))))

    Returns:
      property that will be translated relative to a parent query

  - ### function

    public <T> BaseProperty<T> function(String functionName, Class<T> returnType, BaseProperty<?>... arguments)
    Returns:
      An expression for calling functionName with first argument equals to this property and provided additional arguments

  - ### function

    public <T> BaseProperty<T> function(String functionName, Class<T> returnType, Object... arguments)
    Returns:
      An expression for calling functionName with first argument equals to this property and provided additional arguments

  - ### operator

    public <T> BaseProperty<T> operator(String operator, Class<T> returnType, BaseProperty<?>... arguments)
    Returns:
      An expression for using operator with first argument equals to this property and provided additional arguments

  - ### operator

    public <T> BaseProperty<T> operator(String operator, Class<T> returnType, Object... arguments)
    Returns:
      An expression for using operator with first argument equals to this property and provided additional arguments