E
- The type this property returns.PropertyFactory
and org.apache.cayenne.exp.property
package.@Deprecated public class Property<E> extends BaseProperty<E> implements ComparableProperty<E>, RelationshipProperty<E>
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(..)
create(String, Class)
,
create(Expression, Class)
,
create(String, Expression, Class)
,
PropertyFactory
Modifier and Type | Field and Description |
---|---|
static Property<Long> |
COUNT
Deprecated.
since 4.2 use
PropertyFactory.COUNT |
expressionSupplier, name, type
Modifier | Constructor and 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
|
Modifier and Type | Method and 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(Expression expression,
Class<? super T> type)
Deprecated.
Creates property with expression and type
|
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 extends Persistent> |
createSelf(Class<? super T> type)
Deprecated.
Creates "self" Property for persistent class.
|
<T> Property<T> |
dot(Property<T> property)
Deprecated.
|
Property<Object> |
dot(String property)
Deprecated.
Constructs a property path by appending the argument to the existing property separated by a dot.
|
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> |
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(Property<? extends String> property)
Deprecated.
|
Property<Integer> |
locate(String string)
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.
|
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
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
between, between, gt, gt, gte, gte, lt, lt, lte, lte
disjoint, disjointById, dot, dot, dot, dot, dot, dot, dot, joint
dot, dot, dot, dot
getAlias, getExpression, getName, getType
@Deprecated public static final Property<Long> COUNT
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);
protected Property(String name, Class<E> type)
name
- of the property (usually it's obj path)type
- of the propertycreate(String, Class)
protected Property(String name, Expression expression, Class<E> type)
name
- of the property (will be used as alias for the expression)expression
- expression for propertytype
- of the propertycreate(String, Expression, Class)
public Expression like(String pattern)
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.public Expression like(String pattern, char escapeChar)
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 "_".public Expression likeIgnoreCase(String pattern)
public Expression nlike(String value)
public Expression nlikeIgnoreCase(String value)
public Expression contains(String substring)
substring
- a String to match against property value. "_" and "%" symbols
are NOT treated as wildcards and are escaped when converted to
a LIKE expression.public Expression startsWith(String value)
value
- a String to match against property value. "_" and "%" symbols
are NOT treated as wildcards and are escaped when converted to
a LIKE expression.public Expression endsWith(String value)
value
- a String to match against property value. "_" and "%" symbols
are NOT treated as wildcards and are escaped when converted to
a LIKE expression.public Expression containsIgnoreCase(String value)
contains(String)
, only using case-insensitive
comparison.public Expression startsWithIgnoreCase(String value)
startsWith(String)
, only using case-insensitive
comparison.public Expression endsWithIgnoreCase(String value)
endsWith(String)
, only using case-insensitive
comparison.public Property<String> concat(Object... args)
Arguments will be converted as follows:
Property
than its expression will be usedExpression
than it will be used as is Usage:
Property<String> fullName = Artist.FIRST_NAME.concat(" ", Artist.SECOND_NAME);
public <T extends Persistent> Property<T> flat(Class<T> tClass)
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);
public Property<E> alias(String alias)
alias
in class BaseProperty<E>
public Property<E> outer()
RelationshipProperty
outer
in interface RelationshipProperty<E>
public Property<Object> dot(String property)
dot
in interface PathProperty<E>
public Property<E> max()
max
in interface ComparableProperty<E>
FunctionExpressionFactory.maxExp(Expression)
public Property<E> min()
min
in interface ComparableProperty<E>
FunctionExpressionFactory.minExp(Expression)
public static <T> Property<T> create(String name, Class<? super T> type)
public static <T> Property<T> create(Expression expression, Class<? super T> type)
public static <T> Property<T> create(String name, Expression expression, Class<? super T> type)
create(String, Class)
,
create(Expression, Class)
public static <T extends Persistent> Property<T> createSelf(Class<? super T> type)
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);
Copyright © 2001–2021 Apache Cayenne. All rights reserved.