接口 ValueRef

所有已知实现类:
ValueRef.NullValueRef, ValueRef.TypedValueHolderValueRef

public interface ValueRef
Represents a reference to a value. With a reference it is possible to get or set the value. Passing around value references rather than the values themselves can avoid incorrect duplication of operand evaluation. For example in 'list[index++]++' without a value reference for 'list[index++]' it would be necessary to evaluate list[index++] twice (once to get the value, once to determine where the value goes) and that would double increment index.
从以下版本开始:
4.0
作者:
Andy Clement
  • 嵌套类概要

    嵌套类
    修饰符和类型
    接口
    说明
    static class 
    A ValueRef for the null value.
    static class 
    A ValueRef holder for a single value, which cannot be set.
  • 方法概要

    修饰符和类型
    方法
    说明
    Returns the value this ValueRef points to, it should not require expression component re-evaluation.
    boolean
    Indicates whether calling setValue(Object) is supported.
    void
    setValue(Object newValue)
    Sets the value this ValueRef points to, it should not require expression component re-evaluation.
  • 方法详细资料

    • getValue

      TypedValue getValue()
      Returns the value this ValueRef points to, it should not require expression component re-evaluation.
      返回:
      the value
    • setValue

      void setValue(@Nullable Object newValue)
      Sets the value this ValueRef points to, it should not require expression component re-evaluation.
      参数:
      newValue - the new value
    • isWritable

      boolean isWritable()
      Indicates whether calling setValue(Object) is supported.
      返回:
      true if setValue() is supported for this value reference.