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
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
A ValueRef for the null value.static class
A ValueRef holder for a single value, which cannot be set. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
Returns the value this ValueRef points to, it should not require expression component re-evaluation.boolean
Indicates whether calling setValue(Object) is supported.void
Sets the value this ValueRef points to, it should not require expression component re-evaluation.
-
Method Details
-
getValue
TypedValue getValue()Returns the value this ValueRef points to, it should not require expression component re-evaluation.- Returns:
- the value
-
setValue
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.
-