Package org.apache.cayenne.exp.property

# 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`, `Property`, `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 String`
  `name`
  Name of the property in the object
  `protected final Class<E>`
  `type`
  Explicit type of the property

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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()`
  `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()`
  `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)`
  `Expression`
  `path()`
  Deprecated.
  since 4.2, use `getExpression()` method instead
  `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 java.lang.Object

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

- ## Field Details

  - ### name

    protected final String name
    Name of the property in the object

  - ### 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(String name, Expression expression, Class<? super E> type)
    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
      `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.

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

  - ### path

    @Deprecated public Expression path()
    Deprecated.
    since 4.2, use `getExpression()` method instead
    Converts this property to a path expression. This method is equivalent of getExpression() which is preferred as more generic.
    Returns:
      a newly created expression.
    See Also:
      - `getExpression()`

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

  - ### 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()
    Returns:
      property that will be translated relative to 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