Interface ValueRef

  • All Known Implementing Classes:
    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.
    Since:
    3.2
    Author:
    Andy Clement
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      TypedValuegetValue()
      Returns the value this ValueRef points to, it should not require expression component re-evaluation.
      booleanisWritable()
      Indicates whether calling setValue(Object) is supported.
      voidsetValue​(Object newValue)
      Sets the value this ValueRef points to, it should not require expression component re-evaluation.
    • Method Detail

      • getValue

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

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

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