Class ProjectionResolver<T extends CqnStatement>

java.lang.Object
com.sap.cds.util.ProjectionResolver<T>

public class ProjectionResolver<T extends CqnStatement> extends Object
Stateful implementation of projection resolver. Keeps track of statement that was attempted to be resolved.
  • Method Details

    • create

      public static <T extends CqnStatement> ProjectionResolver<T> create(CdsModel model, T statement)
    • condition

      public ProjectionResolver<T> condition(ProjectionResolver.BiPredicate resolvedCondition)
      Adds the Condition on which the projection is considered resolved
      Parameters:
      resolvedCondition - the Condition on which resolvement stops
      Returns:
      the ProjectionResolver instance
    • condition

      public ProjectionResolver<T> condition(ProjectionResolver.TriPredicate resolvedCondition)
      Adds the Condition on which the projection is considered resolved
      Parameters:
      resolvedCondition - the Condition on which resolvement stops
      Returns:
      the ProjectionResolver instance
    • resolveAll

      public ProjectionResolver<T> resolveAll()
      Resolves the statement against the views defined by the statements entity path and returns the ProjectionResolver object containing it. The statement is resolved until the Condition is not met. If the statement can't be resolved, the original statement is returned.
      Returns:
      resolver object, containing the resolved statement, or the original one, if the projection could not be resolved.
    • resolveAliases

      public ProjectionResolver<T> resolveAliases()
      Resolves any aliases from the statement to their original name. If aliases are resolved the original projection can be restored by using transform(List) or transform(Result).
      Returns:
      resolver object
    • resolve

      public ProjectionResolver<T> resolve()
      Resolves the current statement against its next projection layer. It resolves projections in all refs contained in the statement. If the statement can't be resolved, the original statement is returned.
      Returns:
      ProjectionResolver containing the resolved statement, or the original one, if the projection could not be resolved.
    • getResolvedStatement

      public T getResolvedStatement()
      Returns the resolved statement.
      Returns:
      the resolved statement
    • transform

      public List<? extends Map<String,Object>> transform(List<? extends Map<String,Object>> entries)
      Transforms the list of entries to structurally match the original statement.
      Parameters:
      entries - the execution result for the resolved statement to be transformed into the original representation
      Returns:
      the transformed entries
    • transform

      public Result transform(Result result)
      Transforms the Result to structurally match the original statement. It also redetermines the row type of the Result
      Parameters:
      result - the execution result for the resolved statement to be transformed into the original representation
      Returns:
      the transformed Result