Class SwitchExpression

java.lang.Object
com.yahoo.vespa.objects.Selectable

public final class SwitchExpression extends CompositeExpression
Author:
Simon Thoresen Hult
  • Constructor Details

    • SwitchExpression

      public SwitchExpression(Map<String,T> cases)
    • SwitchExpression

      public SwitchExpression(Map<String,T> cases, Expression defaultExp)
  • Method Details

    • isMutating

      public boolean isMutating()
      Description copied from class: Expression
      Returns whether this expression outputs a different value than what it gets as input. Annotating a string value does not count as modifying it.
      Overrides:
      isMutating in class Expression
    • isEmpty

      public boolean isEmpty()
    • getCases

      public Map<String,Expression> getCases()
    • getDefaultExpression

      public Expression getDefaultExpression()
    • convertChildren

      public SwitchExpression convertChildren(ExpressionConverter converter)
      Description copied from class: Expression
      Returns an expression where the children of this has been converted using the given converter. This default implementation returns this as it has no children.
      Specified by:
      convertChildren in class CompositeExpression
    • setInputType

      public com.yahoo.document.DataType setInputType(com.yahoo.document.DataType inputType, TypeContext context)
      Description copied from class: Expression
      Sets the input type of this and returns the resulting output type, or null if it cannot be uniquely determined. Subtypes may implement this by calling setInputType(inputType, requiredType, VerificationContext context).
      Overrides:
      setInputType in class Expression
    • setOutputType

      public com.yahoo.document.DataType setOutputType(com.yahoo.document.DataType outputType, TypeContext context)
      Description copied from class: Expression
      Sets the output type of this and returns the resulting input type, or null if it cannot be uniquely determined. Subtypes implement this by calling setOutputType(outputType, requiredType, VerificationContext context).
      Overrides:
      setOutputType in class Expression
    • setStatementOutput

      public void setStatementOutput(com.yahoo.document.DocumentType documentType, com.yahoo.document.Field field)
      Description copied from class: Expression
      Sets the document type and field the statement this expression is part of will write to
      Overrides:
      setStatementOutput in class Expression
    • doResolve

      protected void doResolve(TypeContext context)
      Overrides:
      doResolve in class Expression
    • doExecute

      protected void doExecute(ExecutionContext context)
      Specified by:
      doExecute in class Expression
    • selectMembers

      public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
      Overrides:
      selectMembers in class com.yahoo.vespa.objects.Selectable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object