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
Property that represents generic attribute.
Provides equality checks and sorting API along with some utility methods.
- Since:
- 4.2
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Supplier
<Expression> Expression provider for the propertyprotected final String
Name of the property in the objectExplicit type of the property -
Constructor Summary
ModifierConstructorDescriptionprotected
BaseProperty
(String name, Expression expression, Class<? super E> type) Constructs a new property with the given name and expression -
Method Summary
Modifier and TypeMethodDescriptionCreates alias with different name for this propertyasc()
ascs()
count()
desc()
descs()
eq
(BaseProperty<?> value) boolean
<T> BaseProperty
<T> <T> BaseProperty
<T> function
(String functionName, Class<T> returnType, BaseProperty<?>... arguments) getAlias()
This method returns fresh copy of the expression for each call.Extracts property value from an object using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.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.getName()
getType()
int
hashCode()
in
(Collection<E> values) in
(ColumnSelect<? extends E> subquery) isFalse()
isNull()
isTrue()
ne
(BaseProperty<?> value) nin
(Collection<E> values) nin
(ColumnSelect<? extends E> subquery) <T> BaseProperty
<T> <T> BaseProperty
<T> operator
(String operator, Class<T> returnType, BaseProperty<?>... arguments) path()
Deprecated.void
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.
-
Field Details
-
name
Name of the property in the object -
expressionSupplier
Expression provider for the property -
type
Explicit type of the property
-
-
Constructor Details
-
BaseProperty
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 propertytype
- of the property- See Also:
-
-
Method Details
-
getName
-
getAlias
-
getExpression
This method returns fresh copy of the expression for each call.- Specified by:
getExpression
in interfaceProperty<E>
- Returns:
- expression that represents this Property
-
hashCode
public int hashCode() -
equals
-
path
Deprecated.since 4.2, usegetExpression()
method insteadConverts 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:
-
isNull
- Returns:
- An expression representing null.
-
isNotNull
- Returns:
- An expression representing a non-null value.
-
asc
- Returns:
- Ascending sort orderings on this property.
-
ascs
- Returns:
- Ascending sort orderings on this property.
-
ascInsensitive
- Returns:
- Ascending case insensitive sort orderings on this property.
-
ascInsensitives
- Returns:
- Ascending case insensitive sort orderings on this property.
-
desc
- Returns:
- Descending sort orderings on this property.
-
descs
- Returns:
- Descending sort orderings on this property.
-
descInsensitive
- Returns:
- Descending case insensitive sort orderings on this property.
-
descInsensitives
- Returns:
- Descending case insensitive sort orderings on this property.
-
getFrom
Extracts property value from an object using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path. -
getFromAll
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
Sets a property value in 'obj' using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path. -
setInAll
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
- See Also:
-
countDistinct
- See Also:
-
alias
Creates alias with different name for this property -
getType
-
isTrue
- Returns:
- An expression representing equality to TRUE.
-
isFalse
- Returns:
- An expression representing equality to FALSE.
-
eq
- Returns:
- An expression representing equality to a value.
-
eq
- Returns:
- An expression representing equality between two attributes (columns).
-
ne
- Returns:
- An expression representing inequality to a value.
-
ne
- Returns:
- An expression representing inequality between two attributes (columns).
-
in
- Returns:
- An expression for finding objects with values in the given set.
-
nin
- Returns:
- An expression for finding objects with values not in the given set.
-
in
- Returns:
- An expression for finding objects with values in the given set.
-
nin
- Returns:
- An expression for finding objects with values not in the given set.
-
in
- Returns:
- An expression for finding objects with values in the given subquery
-
nin
- Returns:
- An expression for finding objects with values not in the given subquery
-
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
- 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
- Returns:
- An expression for using operator with first argument equals to this property and provided additional arguments
-
getExpression()
method instead