Class Expr

    • Method Detail

      • getId

        public int getId()
      • setId

        public void setId​(int id)
      • addLocation

        public void addLocation​(android.databinding.tool.store.Location location)
      • getLocations

        public java.util.List<android.databinding.tool.store.Location> getLocations()
      • getInvalidFlags

        public java.util.BitSet getInvalidFlags()
      • markAsBindingExpression

        public void markAsBindingExpression()
      • isBindingExpression

        public boolean isBindingExpression()
      • canBeEvaluatedToAVariable

        public boolean canBeEvaluatedToAVariable()
      • isObservable

        public boolean isObservable()
      • getUpdateRegistrationCall

        public java.lang.String getUpdateRegistrationCall​(int id,
                                                          java.lang.String value)
      • setUnwrapObservableFields

        public void setUnwrapObservableFields​(boolean unwrapObservableFields)
      • resolveListeners

        public Expr resolveListeners​(android.databinding.tool.reflection.ModelClass valueType,
                                     Expr parent)
      • safeUnboxChild

        public void safeUnboxChild​(ExprModel model,
                                   Expr child)
        Tries to create a safe unbox method for the given expression.

        Sometimes, the child might be just any object (especially returned from bracket expressions where any value type might be unknown). In this case, child stays instact.

        Parameters:
        model - ExprModel
        child - The child that will be replaced with a safe unbox call.
      • resolveTwoWayExpressions

        public Expr resolveTwoWayExpressions​(Expr parent)
      • resetResolvedType

        protected void resetResolvedType()
      • getShouldReadFlags

        public java.util.BitSet getShouldReadFlags()
      • getShouldReadFlagsWithConditionals

        public java.util.BitSet getShouldReadFlagsWithConditionals()
      • setModel

        public void setModel​(ExprModel model)
      • onSwappedWith

        public void onSwappedWith​(Expr existing)
      • getChildren

        public java.util.List<Expr> getChildren()
      • getParents

        public java.util.List<Expr> getParents()
      • isDynamic

        public boolean isDynamic()
        Whether the result of this expression can change or not. For example, 3 + 5 can not change vs 3 + x may change. Default implementations checks children and returns true if any of them returns true
        Returns:
        True if the result of this expression may change due to variables
      • getResolvedType

        public final android.databinding.tool.reflection.ModelClass getResolvedType()
      • addJustMeToExecutionPath

        @NotNull
        protected final java.util.List<ExecutionPath> addJustMeToExecutionPath​(java.util.List<ExecutionPath> paths)
      • toExecutionPathInOrder

        protected final java.util.List<ExecutionPath> toExecutionPathInOrder​(java.util.List<ExecutionPath> paths,
                                                                             Expr... order)
      • toExecutionPathInOrder

        protected final java.util.List<ExecutionPath> toExecutionPathInOrder​(java.util.List<ExecutionPath> paths,
                                                                             java.util.List<Expr> order)
      • resolveType

        protected abstract android.databinding.tool.reflection.ModelClass resolveType​(android.databinding.tool.reflection.ModelAnalyzer modelAnalyzer)
      • constructDependencies

        protected abstract java.util.List<Dependency> constructDependencies()
      • constructDynamicChildrenDependencies

        protected java.util.List<Dependency> constructDynamicChildrenDependencies()
        Creates a dependency for each dynamic child. Should work for any expression besides conditionals.
      • getDependencies

        public final java.util.List<Dependency> getDependencies()
      • getDependants

        public java.util.List<Dependency> getDependants()
      • getUniqueKey

        public final java.lang.String getUniqueKey()
        Returns a unique string key that can identify this expression. It must take into account any dependencies
        Returns:
        A unique identifier for this expression
      • computeUniqueKey

        protected abstract java.lang.String computeUniqueKey()
      • enableDirectInvalidation

        public void enableDirectInvalidation()
      • canBeInvalidated

        public boolean canBeInvalidated()
      • trimShouldReadFlags

        public void trimShouldReadFlags​(java.util.BitSet bitSet)
      • isConditional

        public boolean isConditional()
      • getRequirementId

        public int getRequirementId()
      • setRequirementId

        public void setRequirementId​(int requirementId)
      • getRequirementFlagIndex

        public int getRequirementFlagIndex​(boolean expectedOutput)
        This is called w/ a dependency of mine. Base method should thr
      • hasId

        public boolean hasId()
      • markFlagsAsRead

        public void markFlagsAsRead​(java.util.BitSet flags)
      • isRead

        public boolean isRead()
      • considerElevatingConditionals

        public boolean considerElevatingConditionals​(Expr justRead)
      • invalidateReadFlags

        public void invalidateReadFlags()
      • getVersion

        public int getVersion()
        Specified by:
        getVersion in interface android.databinding.tool.expr.VersionProvider
      • hasNestedCannotRead

        public boolean hasNestedCannotRead()
      • markAsReadIfDone

        public boolean markAsReadIfDone()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getReadSoFar

        public java.util.BitSet getReadSoFar()
      • getAllCalculationPaths

        protected android.databinding.tool.expr.Expr.Node getAllCalculationPaths()
        All flag paths that will result in calculation of this expression.
      • getDefaultValue

        public java.lang.String getDefaultValue()
      • getPredicateInvalidFlags

        protected java.util.BitSet getPredicateInvalidFlags()
      • shouldReadNow

        public boolean shouldReadNow​(java.util.List<Expr> justRead)
        Used by code generation
      • isEqualityCheck

        public boolean isEqualityCheck()
      • markAsUsed

        public void markAsUsed()
      • markAsUsedInCallback

        public void markAsUsedInCallback()
      • isIsUsedInCallback

        public boolean isIsUsedInCallback()
      • isUsed

        public boolean isUsed()
      • updateExpr

        public void updateExpr​(android.databinding.tool.reflection.ModelAnalyzer modelAnalyzer)
      • join

        protected static java.lang.String join​(java.util.List<?> vals)
      • join

        protected static java.lang.String join​(java.lang.Object... vals)
      • asPackage

        protected java.lang.String asPackage()
      • provideScopeLocation

        public java.util.List<android.databinding.tool.store.Location> provideScopeLocation()
        Specified by:
        provideScopeLocation in interface android.databinding.tool.processing.scopes.LocationScopeProvider
      • toCode

        public android.databinding.tool.writer.KCode toCode()
      • toFullCode

        public android.databinding.tool.writer.KCode toFullCode()
      • generateCode

        protected abstract android.databinding.tool.writer.KCode generateCode()
      • generateInverse

        public Expr generateInverse​(ExprModel model,
                                    Expr value,
                                    java.lang.String bindingClassName)
      • cloneToModel

        public abstract Expr cloneToModel​(ExprModel model)
      • cloneToModel

        protected static java.util.List<Expr> cloneToModel​(ExprModel model,
                                                           java.util.List<Expr> exprs)
      • assertIsInvertible

        public void assertIsInvertible()
      • getInvertibleError

        protected abstract java.lang.String getInvertibleError()
        Returns:
        The reason the expression wasn't invertible or null if it was invertible.
      • hasConditionalDependant

        public boolean hasConditionalDependant()
        This expression is the predicate for 1 or more ternary expressions.
      • recursivelyInjectSafeUnboxing

        public final boolean recursivelyInjectSafeUnboxing​(android.databinding.tool.reflection.ModelAnalyzer modelAnalyzer,
                                                           ExprModel model)
      • unwrapObservableField

        public Expr unwrapObservableField()
      • unwrapObservableFieldChildren

        protected void unwrapObservableFieldChildren()
        Iterates through all children and expands all ObservableFields to call "get()" on them instead.
      • unwrapChildTo

        protected void unwrapChildTo​(int childIndex,
                                     @Nullable
                                     android.databinding.tool.reflection.ModelClass type)
        Unwraps an observable field for a specific child.
        Parameters:
        childIndex - The index into mChildren of the child to unwrap
        type - The expected type or null if the child should be fully unwrapped.
      • injectSafeUnboxing

        protected abstract void injectSafeUnboxing​(android.databinding.tool.reflection.ModelAnalyzer modelAnalyzer,
                                                   ExprModel model)
        Called after experiment model is sealed to avoid NPE problems caused by boxed primitives.