com.holonplatform.core.internal

## Class CallbackExpressionResolver<E extends Expression,R extends Expression>

- java.lang.Object
- - com.holonplatform.core.internal.CallbackExpressionResolver<E,R>

- Type Parameters:
    `E` - Expression type
    `R` - Resolved expression type
  All Implemented Interfaces:
    Expression.ExpressionResolverFunction<E,R>, ExpressionResolver<E,R>, Serializable

      public class CallbackExpressionResolver<E extends Expression,R extends Expression>
      extends Object
      implements ExpressionResolver<E,R>

  A `ExpressionResolver` which uses a `Expression.ExpressionResolverFunction` in conjunction with expression and resolution type to create the resolver implementation.
  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.ExpressionResolver

      `ExpressionResolver.ExpressionResolverBuilder<C extends ExpressionResolver.ExpressionResolverBuilder<C>>, ExpressionResolver.ExpressionResolverHandler, ExpressionResolver.ExpressionResolverProvider, ExpressionResolver.ExpressionResolverSupport, ExpressionResolver.ResolutionContext`

  - ### Field Summary

    - ### Fields inherited from interface com.holonplatform.core.ExpressionResolver

      `DEFAULT_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallbackExpressionResolver(Class<? extends E> expressionType, Class<? extends R> resolvedType, Expression.ExpressionResolverFunction<E,R> function)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Class<? extends E>` | `getExpressionType()` Get the expression type which this resolver can handle.
    `Class<? extends R>` | `getResolvedType()` Get the resolved expression type
    `Optional<R>` | `resolve(E expression, ExpressionResolver.ResolutionContext context)` Try to resolve given `expression`.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver

      `create`

- - ### Constructor Detail

    - #### CallbackExpressionResolver

          public CallbackExpressionResolver(Class<? extends E> expressionType,
                                            Class<? extends R> resolvedType,
                                            Expression.ExpressionResolverFunction<E,R> function)

  - ### Method Detail

    - #### resolve

          public Optional<R> resolve(E expression,
                                     ExpressionResolver.ResolutionContext context)
                              throws Expression.InvalidExpressionException

      Description copied from interface: `Expression.ExpressionResolverFunction`
      Try to resolve given `expression`. If the resolver is not able to resolve given expression type, an empty Optional must be returned and the expression resolution engine should delegate the resolution to the next resolver, if available.

      Concrete resolution environments could provide a more specialized `ExpressionResolver.ResolutionContext` interface.

      Specified by:
        `resolve` in interface `Expression.ExpressionResolverFunction<E extends Expression,R extends Expression>`
      Parameters:
        `expression` - Expression to resolve
        `context` - Resolution context
      Returns:
        Resolved expression, or an empty Optional if this resolver is not able to resolve given expression
      Throws:
        `Expression.InvalidExpressionException` - An error occurred during expression resolution

    - #### getExpressionType

          public Class<? extends E> getExpressionType()

      Description copied from interface: `ExpressionResolver`
      Get the expression type which this resolver can handle.
      Specified by:
        `getExpressionType` in interface `ExpressionResolver<E extends Expression,R extends Expression>`
      Returns:
        Expression type (not null)

    - #### getResolvedType

          public Class<? extends R> getResolvedType()

      Description copied from interface: `ExpressionResolver`
      Get the resolved expression type
      Specified by:
        `getResolvedType` in interface `ExpressionResolver<E extends Expression,R extends Expression>`
      Returns:
        Resolved expression type (not null)

Copyright © 2019 The Holon Platform. All rights reserved.