Class InferenceContext


  • @Internal
    public class InferenceContext
    extends java.lang.Object
    An object holding a context for type inference.

    Consists of a type substitution and a generator for free type variables in the context, as well as methods to work with the context.

    CEL Library Internals. Do Not Use.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CelType finalize​(CelType type)
      Finalizes the given type by applying the current type substitution and mapping all remaining type parameters to DYN.
      boolean isAssignable​(CelType type1, CelType type2)
      Checks whether type1 is assignable to type2 under refinement of the type substitution.
      boolean isAssignable​(java.util.List<CelType> list1, java.util.List<CelType> list2)
      Same as isAssignable(CelType, CelType) for lists of types.
      CelType newInstance​(java.lang.Iterable<java.lang.String> typeParams, CelType type)
      Returns an instance of the given type where all given type parameters are replaced by fresh type variables.
      CelType newTypeVar​(java.lang.String prefix)
      Creates a fresh type variable in the given context.
      CelType specialize​(CelType type)
      Specializes the given type using the substitution of this context.
      java.util.List<CelType> specialize​(java.util.List<CelType> types)
      Specializes using given type list of types using the substitution of this context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InferenceContext

        public InferenceContext()
    • Method Detail

      • newTypeVar

        public CelType newTypeVar​(java.lang.String prefix)
        Creates a fresh type variable in the given context.
      • newInstance

        public CelType newInstance​(java.lang.Iterable<java.lang.String> typeParams,
                                   CelType type)
        Returns an instance of the given type where all given type parameters are replaced by fresh type variables.
      • isAssignable

        @CanIgnoreReturnValue
        public boolean isAssignable​(CelType type1,
                                    CelType type2)
        Checks whether type1 is assignable to type2 under refinement of the type substitution. Returns true on success, and false on failure. The substitution in the type context will not be modified on failure.
      • specialize

        public CelType specialize​(CelType type)
        Specializes the given type using the substitution of this context.
      • specialize

        public java.util.List<CelType> specialize​(java.util.List<CelType> types)
        Specializes using given type list of types using the substitution of this context.
      • finalize

        public CelType finalize​(CelType type)
        Finalizes the given type by applying the current type substitution and mapping all remaining type parameters to DYN.