DateProperty (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.exp.property, class: DateProperty

# Class DateProperty<E>

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

All Implemented Interfaces:
  `ComparableProperty<E>, Property<E>`

public class DateProperty<E> extends BaseProperty<E> implements ComparableProperty<E>
Property that represents date/time attribute.

    ObjectSelect.query(Artist.class)
         .where(Artist.DATE_OF_BIRTH.year().lte(1900))
         .or(Artist.DATE_OF_BIRTH.month().between(6, 8))

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

- ## Field Summary

  ### Fields inherited from class BaseProperty

  `expressionSupplier, path, type`
  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`
  `DateProperty(CayennePath path, Expression expression, Class<E> type)`
  Constructs a new property with the given name and expression

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DateProperty<E>`
  `alias(String alias)`
  Creates alias with different name for this property
  `NumericProperty<Integer>`
  `dayOfMonth()`
  It is a caller responsibility to check that underlying attribute has day component
  `NumericProperty<Integer>`
  `dayOfYear()`
  It is a caller responsibility to check that underlying attribute has day component
  `DateProperty<E>`
  `enclosing()`
  This operator allows to access properties of the enclosing query from the subquery.
  `NumericProperty<Integer>`
  `hour()`
  It is a caller responsibility to check that underlying attribute has time component
  `DateProperty<E>`
  `max()`
  `DateProperty<E>`
  `min()`
  `NumericProperty<Integer>`
  `minute()`
  It is a caller responsibility to check that underlying attribute has time component
  `NumericProperty<Integer>`
  `month()`
  It is a caller responsibility to check that underlying attribute has month component
  `NumericProperty<Integer>`
  `second()`
  It is a caller responsibility to check that underlying attribute has time component
  `NumericProperty<Integer>`
  `year()`
  It is a caller responsibility to check that underlying attribute has year component

  ### 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`
  Modifier and Type
  Method
  Description
  `<T> BaseProperty<T>`
  `aggregate(String function, Class<T> type)`
  `Ordering`
  `asc()`
  `Ordering`
  `ascInsensitive()`
  `Orderings`
  `ascInsensitives()`
  `Orderings`
  `ascs()`
  `NumericProperty<Long>`
  `count()`
  `NumericProperty<Long>`
  `countDistinct()`
  `Ordering`
  `desc()`
  `Ordering`
  `descInsensitive()`
  `Orderings`
  `descInsensitives()`
  `Orderings`
  `descs()`
  `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`

  ### Methods inherited from interface ComparableProperty

  `between, between, gt, gt, gtAll, gtAny, gte, gte, gteAll, gteAny, lt, lt, ltAll, ltAny, lte, lte, lteAll, lteAny`
  Modifier and Type
  Method
  Description
  `default Expression`
  `between(E lower, E upper)`
  `default Expression`
  `between(ComparableProperty<?> lower, ComparableProperty<?> upper)`
  `default Expression`
  `gt(E value)`
  `default Expression`
  `gt(ComparableProperty<?> value)`
  `default Expression`
  `gtAll(ColumnSelect<E> subquery)`
  `default Expression`
  `gtAny(ColumnSelect<E> subquery)`
  `default Expression`
  `gte(E value)`
  `default Expression`
  `gte(ComparableProperty<?> value)`
  `default Expression`
  `gteAll(ColumnSelect<E> subquery)`
  `default Expression`
  `gteAny(ColumnSelect<E> subquery)`
  `default Expression`
  `lt(E value)`
  `default Expression`
  `lt(ComparableProperty<?> value)`
  `default Expression`
  `ltAll(ColumnSelect<E> subquery)`
  `default Expression`
  `ltAny(ColumnSelect<E> subquery)`
  `default Expression`
  `lte(E value)`
  `default Expression`
  `lte(ComparableProperty<?> value)`
  `default Expression`
  `lteAll(ColumnSelect<E> subquery)`
  `default Expression`
  `lteAny(ColumnSelect<E> subquery)`

- ## Constructor Details

  - ### DateProperty

    protected DateProperty(CayennePath path, Expression expression, Class<E> type)
    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
      `type` - of the property

- ## Method Details

  - ### year

    public NumericProperty<Integer> year()
    It is a caller responsibility to check that underlying attribute has year component
    Returns:
      new property that represents year component of this date property
    See Also:
      - `FunctionExpressionFactory.yearExp(Expression)`

  - ### month

    public NumericProperty<Integer> month()
    It is a caller responsibility to check that underlying attribute has month component
    Returns:
      new property that represents month component of this date property
    See Also:
      - `FunctionExpressionFactory.monthExp(Expression)`

  - ### dayOfMonth

    public NumericProperty<Integer> dayOfMonth()
    It is a caller responsibility to check that underlying attribute has day component
    Returns:
      new property that represents day of month component of this date property
    See Also:
      - `FunctionExpressionFactory.dayOfMonthExp(Expression)`

  - ### dayOfYear

    public NumericProperty<Integer> dayOfYear()
    It is a caller responsibility to check that underlying attribute has day component
    Returns:
      new property that represents day of year component of this date property
    See Also:
      - `FunctionExpressionFactory.dayOfMonthExp(Expression)`

  - ### hour

    public NumericProperty<Integer> hour()
    It is a caller responsibility to check that underlying attribute has time component
    Returns:
      new property that represents hour component of this time property
    See Also:
      - `FunctionExpressionFactory.hourExp(Expression)`

  - ### minute

    public NumericProperty<Integer> minute()
    It is a caller responsibility to check that underlying attribute has time component
    Returns:
      new property that represents minute component of this time property
    See Also:
      - `FunctionExpressionFactory.minuteExp(Expression)`

  - ### second

    public NumericProperty<Integer> second()
    It is a caller responsibility to check that underlying attribute has time component
    Returns:
      new property that represents second component of this time property
    See Also:
      - `FunctionExpressionFactory.secondExp(Expression)`

  - ### alias

    public DateProperty<E> alias(String alias)
    Creates alias with different name for this property
    Overrides:
      `alias` in class `BaseProperty<E>`

  - ### max

    public DateProperty<E> max()
    Specified by:
      `max` in interface `ComparableProperty<E>`
    See Also:
      - `FunctionExpressionFactory.maxExp(Expression)`

  - ### min

    public DateProperty<E> min()
    Specified by:
      `min` in interface `ComparableProperty<E>`
    See Also:
      - `FunctionExpressionFactory.minExp(Expression)`

  - ### enclosing

    public DateProperty<E> 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<E>`
    Returns:
      property that will be translated relative to parent query