# Interface Expression<R,V>

Type Parameters:
  `R` - the type of resources (e.g. `Feature`) used as inputs.
  `V` - the type of values computed by the expression.

All Superinterfaces:
  `Function<R,V>`

All Known Subinterfaces:
  `Optimization​.OnExpression<R,V>`

public interface Expression<R,V> extends Function<R,V>
A literal or a named procedure that performs a distinct computation.
Upcoming API change
This is a placeholder for a GeoAPI 3.1 interface not yet released. In a future version, all usages of this interface may be replaced by an interface of the same name but in the `org​.opengis​.filter` package instead of `org​.apache​.sis​.filter`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `V`
  `apply(R input)`
  Evaluates the expression value based on the content of the given object.
  `ScopedName`
  `getFunctionName()`
  Returns the name of the function to be called.
  `List<Expression<R,?>>`
  `getParameters()`
  Returns the list sub-expressions that will be evaluated to provide the parameters to the function.
  `Class<? super R>`
  `getResourceClass()`
  Returns the class of resources expected by this expression.
  `<N> Expression<R,N>`
  `toValueType(Class<N> type)`
  Returns an expression doing the same evaluation than this method, but returning results as values of the specified type.

  ### Methods inherited from interface Function

  `andThen, compose`

- ## Method Details

  - ### getFunctionName

    ScopedName getFunctionName()
    Returns the name of the function to be called.
    Returns:
      name of the function to be called.

  - ### getResourceClass

    Class<? super R> getResourceClass()
    Returns the class of resources expected by this expression.
    Returns:
      type of resources accepted by this expression.

  - ### getParameters

    List<Expression<R,?>> getParameters()
    Returns the list sub-expressions that will be evaluated to provide the parameters to the function.
    Returns:
      the sub-expressions to be evaluated, or an empty list if none.

  - ### apply

    V apply(R input)
    Evaluates the expression value based on the content of the given object.
    Specified by:
      `apply` in interface `Function<R,V>`
    Parameters:
      `input` - the object to be evaluated by the expression. Can be `null` if this expression allows null values.
    Returns:
      value computed by the expression.
    Throws:
      `NullPointerException` - if `input` is null and this expression requires non-null values.
      `IllegalArgumentException` - if the expression can not be applied on the given object.

  - ### toValueType

    <N> Expression<R,N> toValueType(Class<N> type)
    Returns an expression doing the same evaluation than this method, but returning results as values of the specified type.
    Type Parameters:
      `N` - compile-time value of `type`.
    Parameters:
      `type` - desired type of expression results.
    Returns:
      expression doing the same operation this this expression but with results of the specified type.
    Throws:
      `ClassCastException` - if the specified type is not a target type supported by implementation.