org.apache.cayenne.exp.property

## 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 org.apache.cayenne.exp.property.BaseProperty

      `expressionSupplier, name, type`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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()`
    `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 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.ComparableProperty

      `between, between, gt, gt, gte, gte, lt, lt, lte, lte`

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

      `getAlias, getExpression, getName, getType`

- - ### Constructor Detail

    - #### DateProperty

          protected DateProperty(String name,
                                 Expression expression,
                                 Class<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

  - ### Method Detail

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

      Overrides:
        `enclosing` in class `BaseProperty<E>`
      Returns:
        property that will be translated relative to parent query

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