Package org.apache.cayenne.exp

# Class Property<E>

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

Type Parameters:
  `E` - The type this property returns.

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

@Deprecated public class Property<E> extends BaseProperty<E> implements ComparableProperty<E>, RelationshipProperty<E>
Deprecated.
since 4.2 in favour of type-specific set of properties, see `PropertyFactory` and `org.apache.cayenne.exp.property` package.

A property in a `DataObject`.

Used to construct Expressions quickly and with type-safety, and to construct Orderings.

Instances of this class are immutable.

Must be created via factory methods `Property.create(..)`

Since:
  4.0
See Also:
  - `create(String, Class)`
  - `create(Expression, Class)`
  - `create(String, Expression, Class)`
  - `PropertyFactory`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Property<Long>`
  `COUNT`
  Deprecated.
  since 4.2 use `PropertyFactory.COUNT`

  ### Fields inherited from class org.apache.cayenne.exp.property.BaseProperty

  `expressionSupplier, name, type`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Property<E>`
  `abs()`
  Deprecated.
  `Property<E>`
  `alias(String alias)`
  Deprecated.
  Creates alias with different name for this property
  `Property<E>`
  `avg()`
  Deprecated.
  `Property<String>`
  `concat(Object... args)`
  Deprecated.
  Arguments will be converted as follows: if argument is a `Property` than its expression will be used if argument is a `Expression` than it will be used as is all other values will be converted to String
  `Expression`
  `contains(String substring)`
  Deprecated.
  Creates an expression for a database "LIKE" query with the value converted to a pattern matching anywhere in the String.
  `Expression`
  `containsIgnoreCase(String value)`
  Deprecated.
  Same as `contains(String)`, only using case-insensitive comparison.
  `static <T> Property<T>`
  `create(String name, Class<? super T> type)`
  Deprecated.
  Creates property with name and type
  `static <T> Property<T>`
  `create(String name, Expression expression, Class<? super T> type)`
  Deprecated.
  Creates property with name, expression and type
  `static <T> Property<T>`
  `create(Expression expression, Class<? super T> type)`
  Deprecated.
  Creates property with expression and type
  `static <T extends Persistent>
  Property<T>`
  `createSelf(Class<? super T> type)`
  Deprecated.
  Creates "self" Property for persistent class.
  `Property<Object>`
  `dot(String property)`
  Deprecated.
  Constructs a property path by appending the argument to the existing property separated by a dot.
  `<T> Property<T>`
  `dot(Property<T> property)`
  Deprecated.
  `Expression`
  `endsWith(String value)`
  Deprecated.
  Creates an expression for a database "LIKE" query with the value converted to a pattern matching the tail of a String.
  `Expression`
  `endsWithIgnoreCase(String value)`
  Deprecated.
  Same as `endsWith(String)`, only using case-insensitive comparison.
  `<T extends Persistent>
  Property<T>`
  `flat(Class<T> tClass)`
  Deprecated.
  Create new "flat" property for toMany relationship.
  `Property<Integer>`
  `length()`
  Deprecated.
  `Expression`
  `like(String pattern)`
  Deprecated.
  `Expression`
  `like(String pattern, char escapeChar)`
  Deprecated.
  `Expression`
  `likeIgnoreCase(String pattern)`
  Deprecated.
  `Property<Integer>`
  `locate(String string)`
  Deprecated.
  `Property<Integer>`
  `locate(Property<? extends String> property)`
  Deprecated.
  `Property<String>`
  `lower()`
  Deprecated.
  `Property<E>`
  `max()`
  Deprecated.
  `Property<E>`
  `min()`
  Deprecated.
  `Property<E>`
  `mod(Number number)`
  Deprecated.
  `Expression`
  `nlike(String value)`
  Deprecated.
  `Expression`
  `nlikeIgnoreCase(String value)`
  Deprecated.
  `Property<E>`
  `outer()`
  Deprecated.
  Returns a version of this property that represents an OUTER join.
  `Property<E>`
  `sqrt()`
  Deprecated.
  `Expression`
  `startsWith(String value)`
  Deprecated.
  Creates an expression for a database "LIKE" query with the value converted to a pattern matching the beginning of a String.
  `Expression`
  `startsWithIgnoreCase(String value)`
  Deprecated.
  Same as `startsWith(String)`, only using case-insensitive comparison.
  `Property<String>`
  `substring(int offset, int length)`
  Deprecated.
  `Property<E>`
  `sum()`
  Deprecated.
  `Property<String>`
  `trim()`
  Deprecated.
  `Property<String>`
  `upper()`
  Deprecated.

  ### Methods inherited from class org.apache.cayenne.exp.property.BaseProperty

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

  `dot, dot, dot, dot`

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

  `getAlias, getExpression, getName, getType`

  ### Methods inherited from interface org.apache.cayenne.exp.property.RelationshipProperty

  `disjoint, disjointById, dot, dot, dot, dot, dot, dot, dot, joint`

- ## Field Details

  - ### COUNT

    @Deprecated public static final Property<Long> COUNT
    Deprecated.
    since 4.2 use `PropertyFactory.COUNT`

    Property that can be used in COUNT(*) queries

         List<Object[]> result = ObjectSelect
                 .columnQuery(Artist.class, Property.COUNT, Artist.ARTIST_NAME)
                 .having(Property.COUNT.gt(1L))
                 .select(context);

- ## Constructor Details

  - ### Property

    protected Property(String name, Class<E> type)
    Deprecated.
    Constructs a new property with the given name and type.
    Parameters:
      `name` - of the property (usually it's obj path)
      `type` - of the property
    See Also:
      - `create(String, Class)`

  - ### Property

    protected Property(String name, Expression expression, Class<E> type)
    Deprecated.
    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:
      - `create(String, Expression, Class)`

- ## Method Details

  - ### like

    public Expression like(String pattern)
    Deprecated.
    Parameters:
      `pattern` - a pattern matching property value. Pattern may include "_" and "%" wildcard symbols to match any single character or a sequence of characters. To prevent "_" and "%" from being treated as wildcards, they need to be escaped and escape char passed with `like(String, char)` method.
    Returns:
      An expression for a Database "LIKE" query.

  - ### like

    public Expression like(String pattern, char escapeChar)
    Deprecated.
    Parameters:
      `pattern` - a properly escaped pattern matching property value. Pattern may include "_" and "%" wildcard symbols to match any single character or a sequence of characters.
      `escapeChar` - an escape character used in the pattern to escape "%" and "_".
    Returns:
      An expression for a Database "LIKE" query.

  - ### likeIgnoreCase

    public Expression likeIgnoreCase(String pattern)
    Deprecated.
    Returns:
      An expression for a case insensitive "LIKE" query.

  - ### nlike

    public Expression nlike(String value)
    Deprecated.
    Returns:
      An expression for a Database "NOT LIKE" query.

  - ### nlikeIgnoreCase

    public Expression nlikeIgnoreCase(String value)
    Deprecated.
    Returns:
      An expression for a case insensitive "NOT LIKE" query.

  - ### contains

    public Expression contains(String substring)
    Deprecated.
    Creates an expression for a database "LIKE" query with the value converted to a pattern matching anywhere in the String.
    Parameters:
      `substring` - a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
    Returns:
      a newly created expression.

  - ### startsWith

    public Expression startsWith(String value)
    Deprecated.
    Creates an expression for a database "LIKE" query with the value converted to a pattern matching the beginning of a String.
    Parameters:
      `value` - a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
    Returns:
      a newly created expression.

  - ### endsWith

    public Expression endsWith(String value)
    Deprecated.
    Creates an expression for a database "LIKE" query with the value converted to a pattern matching the tail of a String.
    Parameters:
      `value` - a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
    Returns:
      a newly created expression.

  - ### containsIgnoreCase

    public Expression containsIgnoreCase(String value)
    Deprecated.
    Same as `contains(String)`, only using case-insensitive comparison.

  - ### startsWithIgnoreCase

    public Expression startsWithIgnoreCase(String value)
    Deprecated.
    Same as `startsWith(String)`, only using case-insensitive comparison.

  - ### endsWithIgnoreCase

    public Expression endsWithIgnoreCase(String value)
    Deprecated.
    Same as `endsWith(String)`, only using case-insensitive comparison.

  - ### length

    public Property<Integer> length()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.lengthExp(Expression)`

  - ### locate

    public Property<Integer> locate(String string)
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.locateExp(String, Expression)`

  - ### locate

    public Property<Integer> locate(Property<? extends String> property)
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.locateExp(Expression, Expression)`

  - ### trim

    public Property<String> trim()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.trimExp(Expression)`

  - ### upper

    public Property<String> upper()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.upperExp(Expression)`

  - ### lower

    public Property<String> lower()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.lowerExp(Expression)`

  - ### concat

    public Property<String> concat(Object... args)
    Deprecated.

    Arguments will be converted as follows:

    - if argument is a `Property` than its expression will be used
    - if argument is a `Expression` than it will be used as is
    - all other values will be converted to String

    Usage:

             Property<String> fullName = Artist.FIRST_NAME.concat(" ", Artist.SECOND_NAME);

    See Also:
      - `FunctionExpressionFactory.concatExp(Expression...)`

  - ### substring

    public Property<String> substring(int offset, int length)
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.substringExp(Expression, int, int)`

  - ### avg

    public Property<E> avg()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.avgExp(Expression)`

  - ### sum

    public Property<E> sum()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.sumExp(Expression)`

  - ### mod

    public Property<E> mod(Number number)
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.modExp(Expression, Number)`

  - ### abs

    public Property<E> abs()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.absExp(Expression)`

  - ### sqrt

    public Property<E> sqrt()
    Deprecated.
    See Also:
      - `FunctionExpressionFactory.sqrtExp(Expression)`

  - ### flat

    public <T extends Persistent> Property<T> flat(Class<T> tClass)
    Deprecated.

    Create new "flat" property for toMany relationship.

    Example:

             List<Object[]> result = ObjectSelect
                  .columnQuery(Artist.class, Artist.ARTIST_NAME, Artist.PAINTING_ARRAY.flat(Painting.class))
                  .select(context);

  - ### alias

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

  - ### outer

    public Property<E> outer()
    Deprecated.
    Description copied from interface: `RelationshipProperty`
    Returns a version of this property that represents an OUTER join. It is up to caller to ensure that the property corresponds to a relationship, as "outer" attributes make no sense.
    Specified by:
      `outer` in interface `RelationshipProperty<E>`

  - ### dot

    public <T> Property<T> dot(Property<T> property)
    Deprecated.

  - ### dot

    public Property<Object> dot(String property)
    Deprecated.
    Constructs a property path by appending the argument to the existing property separated by a dot.
    Specified by:
      `dot` in interface `PathProperty<E>`
    Returns:
      a newly created Property object.

  - ### max

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

  - ### min

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

  - ### create

    public static <T> Property<T> create(String name, Class<? super T> type)
    Deprecated.
    Creates property with name and type
    See Also:
      - `create(Expression, Class)`
      - `create(String, Expression, Class)`

  - ### create

    public static <T> Property<T> create(Expression expression, Class<? super T> type)
    Deprecated.
    Creates property with expression and type
    See Also:
      - `create(String, Class)`
      - `create(String, Expression, Class)`

  - ### create

    public static <T> Property<T> create(String name, Expression expression, Class<? super T> type)
    Deprecated.
    Creates property with name, expression and type
    See Also:
      - `create(String, Class)`
      - `create(Expression, Class)`

  - ### createSelf

    public static <T extends Persistent> Property<T> createSelf(Class<? super T> type)
    Deprecated.

    Creates "self" Property for persistent class. This property can be used to select full object along with some of it properties (or properties that can be resolved against query root)

    Here is sample code, that will select all Artists and count of their Paintings:

             Property<Artist> artistFull = Property.createSelf(Artist.class);
             List<Object[]> result = ObjectSelect
                  .columnQuery(Artist.class, artistFull, Artist.PAINTING_ARRAY.count())
                  .select(context);