Object
NamedExpression
- All Implemented Interfaces:
Serializable
- Enclosing class:
FeatureQuery
An expression to be retrieved by a
Query
, together with the name to assign to it.
NamedExpression
specifies also if the expression should be evaluated exactly once
and its value stored, or evaluated every times that the value is requested.
Analogy with relational databases
ANamedExpression
instance can be understood as the definition of a column in a SQL database table.
In relational database terminology, subset of columns is called projection.
A projection is specified by a SQL SELECT
statement, which maps to NamedExpression
as below:
SELECT
expression
AS
alias
FeatureQuery.setProjection(NamedExpression[])
method.- Since:
- 1.1
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionfinal GenericName
The name to assign to the expression result, ornull
if unspecified.final Expression
<? super AbstractFeature, ?> The literal, value reference or more complex expression to be retrieved by aQuery
.Whether the expression result should be stored or evaluated every times that it is requested. -
Constructor Summary
ConstructorDescriptionNamedExpression
(Expression<? super AbstractFeature, ?> expression) Creates a new stored column with the given expression and no name.NamedExpression
(Expression<? super AbstractFeature, ?> expression, String alias) Creates a new stored column with the given expression and the given name.NamedExpression
(Expression<? super AbstractFeature, ?> expression, GenericName alias) Creates a new stored column with the given expression and the given name.NamedExpression
(Expression<? super AbstractFeature, ?> expression, GenericName alias, FeatureQuery.ProjectionType type) Creates a new column with the given expression, the given name and the given projection type. -
Method Summary
-
Field Details
-
expression
The literal, value reference or more complex expression to be retrieved by aQuery
. Nevernull
. -
alias
The name to assign to the expression result, ornull
if unspecified. -
type
Whether the expression result should be stored or evaluated every times that it is requested. A stored value will exist as a featureAbstractAttribute
, while a virtual value will exist as a featureAbstractOperation
. The latter are commonly called "computed fields" and are equivalent to SQLGENERATED ALWAYS
keyword for columns.- Since:
- 1.4
-
-
Constructor Details
-
NamedExpression
Creates a new stored column with the given expression and no name.- Parameters:
expression
- the literal, value reference or expression to be retrieved by aQuery
.
-
NamedExpression
Creates a new stored column with the given expression and the given name.- Parameters:
expression
- the literal, value reference or expression to be retrieved by aQuery
.alias
- the name to assign to the expression result, ornull
if unspecified.
-
NamedExpression
Creates a new stored column with the given expression and the given name. This constructor creates aLocalName
from the given string.- Parameters:
expression
- the literal, value reference or expression to be retrieved by aQuery
.alias
- the name to assign to the expression result, ornull
if unspecified.
-
NamedExpression
public NamedExpression(Expression<? super AbstractFeature, ?> expression, GenericName alias, FeatureQuery.ProjectionType type) Creates a new column with the given expression, the given name and the given projection type.- Parameters:
expression
- the literal, value reference or expression to be retrieved by aQuery
.alias
- the name to assign to the expression result, ornull
if unspecified.type
- whether to create a featureAbstractAttribute
or a featureAbstractOperation
.- Since:
- 1.4
-
-
Method Details
-
hashCode
public int hashCode()Returns a hash code value for this column. -
equals
Compares this column with the given object for equality. -
toString
Returns a string representation of this column for debugging purpose.
-