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,StringProperty
Property that represents generic attribute.
Provides equality checks and sorting API along with some utility methods.
- Since:
- 4.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Supplier<Expression>Expression provider for the propertyprotected final CayennePathPath of this propertyExplicit type of the property -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseProperty(CayennePath path, Expression expression, Class<? super E> type) Constructs a new property with the given name and expression -
Method Summary
Modifier and TypeMethodDescription<T> BaseProperty<T>Creates alias with different name for this propertyasc()ascs()count()desc()descs()This operator allows to access properties of the enclosing query from the subquery.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()getPath()getType()inthashCode()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) voidSets a property value in 'obj' using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.voidsetInAll(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
-
path
Path of this property -
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:
path- path value of the property (will be used as alias for the expression)expression- expression for propertytype- of the property- See Also:
-
-
Method Details
-
getName
-
getPath
-
getAlias
-
getExpression
This method returns fresh copy of the expression for each call.- Specified by:
getExpressionin interfaceProperty<E>- Returns:
- expression that represents this Property
-
hashCode
public int hashCode() -
equals
-
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
-
countDistinct
-
aggregate
- Since:
- 5.0
- 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
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()))))- Returns:
- property that will be translated relative to a 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
-