Class: Operaton::Bpm::Client::Variable::Impl::VariableValue
- Inherits:
-
Object
- Object
- Operaton::Bpm::Client::Variable::Impl::VariableValue
- Defined in:
- lib/operaton/bpm/client/variable/impl/variable_value.rb
Overview
Mirrors org.operaton.bpm.client.variable.impl.VariableValue — lazily deserialized variable value received from the engine.
Instance Method Summary collapse
-
#initialize(execution_id, variable_name, typed_value_field, mappers) ⇒ VariableValue
constructor
A new instance of VariableValue.
- #serializer ⇒ Object
- #to_s ⇒ Object
- #typed_value(deserialize_value = true) ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(execution_id, variable_name, typed_value_field, mappers) ⇒ VariableValue
Returns a new instance of VariableValue.
11 12 13 14 15 16 17 18 |
# File 'lib/operaton/bpm/client/variable/impl/variable_value.rb', line 11 def initialize(execution_id, variable_name, typed_value_field, mappers) @execution_id = execution_id @variable_name = variable_name @typed_value_field = typed_value_field @mappers = mappers @serializer = nil @cached_value = nil end |
Instance Method Details
#serializer ⇒ Object
42 43 44 |
# File 'lib/operaton/bpm/client/variable/impl/variable_value.rb', line 42 def serializer @serializer ||= @mappers.find_mapper_for_typed_value_field(@typed_value_field) end |
#to_s ⇒ Object
46 47 48 49 |
# File 'lib/operaton/bpm/client/variable/impl/variable_value.rb', line 46 def to_s "VariableValue [cachedValue=#{@cached_value}, executionId=#{@execution_id}, " \ "variableName=#{@variable_name}, typedValueField=#{@typed_value_field}]" end |
#typed_value(deserialize_value = true) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/operaton/bpm/client/variable/impl/variable_value.rb', line 24 def typed_value(deserialize_value = true) if deserialize_value && @cached_value.is_a?(Engine::Variable::ObjectValue) && !@cached_value.deserialized? @cached_value = nil end if @cached_value.nil? @cached_value = serializer.read_value(@typed_value_field, deserialize_value) if @cached_value.is_a?(Value::DeferredFileValueImpl) @cached_value.execution_id = @execution_id @cached_value.variable_name = @variable_name end end @cached_value end |
#value ⇒ Object
20 21 22 |
# File 'lib/operaton/bpm/client/variable/impl/variable_value.rb', line 20 def value typed_value&.value end |