Module org.apache.sis.storage
Package org.apache.sis.storage

# Enum Class FeatureQuery.ProjectionType

Object
Enum<FeatureQuery.ProjectionType>
ProjectionType

All Implemented Interfaces:
  `Serializable`, `Comparable<FeatureQuery​.ProjectionType>`, `Constable`

Enclosing class:
  `FeatureQuery`

public static enum FeatureQuery.ProjectionType extends Enum<FeatureQuery.ProjectionType>
Whether a property evaluated by a query is computed on the fly or stored. By default, an expression is evaluated only once for each feature instance, then the result is stored as a feature `AbstractAttribute` value. But the same expression can also be wrapped in a feature `AbstractOperation` and evaluated every times that the value is requested.

## Analogy with relational databases

The terminology used in this enumeration is close to the one used in relational database. A projection is the set of feature properties to keep in the query results. The projection may contain generated columns, which are specified in SQL by `SQL GENERATED ALWAYS` statement, optionally with `STORED` or `VIRTUAL` modifier.

Since:
  1.4

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class Enum

  `Enum​.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `COMPUTING`
  The expression is evaluated every times that the property value is requested.
  `STORED`
  The expression is evaluated exactly once when a feature instance is created, and the result is stored as a feature attribute.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static FeatureQuery​.ProjectionType`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static FeatureQuery​.ProjectionType[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods inherited from class Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### STORED

    public static final FeatureQuery.ProjectionType STORED
    The expression is evaluated exactly once when a feature instance is created, and the result is stored as a feature attribute. The feature property type will be `AbstractAttribute` and its value will be modifiable. This is the default projection type.

    #### Feature instances in expression evaluation

    The features given in calls to `Expression​.apply(Object)` are instances from the source `FeatureSet`, before filtering.

  - ### COMPUTING

    public static final FeatureQuery.ProjectionType COMPUTING
    The expression is evaluated every times that the property value is requested. The feature property type will be `AbstractOperation`. This projection type may be preferable to `STORED` in the following circumstances:
    - The expression may produce different results every times that it is evaluated.
    - The feature property should be a link to another attribute.
    - Potentially expensive computation should be deferred until first needed.
    - Computation result should not be stored in order to reduce memory usage.

    #### Feature instances in expression evaluation

    The features given in calls to `Expression​.apply(Object)` are instances from the target `FeatureSet`, after filtering. The instances from the source `FeatureSet` are no longer available when the expression is executed. Consequently, all fields that are necessary for computing a `COMPUTING` field shall have been first copied in `STORED` fields.
    Note on naming: verb tense -ing instead of -ed is for emphasizing that the data used for computation are current (filtered) data instead of past (original) data.
    See Also:
      - `FeatureOperations​.function(Map, Function, AttributeType)`

- ## Method Details

  - ### values

    public static FeatureQuery.ProjectionType[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static FeatureQuery.ProjectionType valueOf(String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum class has no constant with the specified name
      `NullPointerException` - if the argument is null