Class: Seasar::Container::Assembler::ManualPropertyAssembler
- Inherits:
-
AbstractAssembler
- Object
- AbstractAssembler
- Seasar::Container::Assembler::ManualPropertyAssembler
- Defined in:
- lib/seasar/container/assembler/manual-property-assembler.rb
Overview
マニュアルインジェクションでプロパティを設定するアセンブラです。
Direct Known Subclasses
Instance Method Summary collapse
-
#assemble(component) ⇒ Object
マニュアルプロパティインジェクションを実施します。 - args 1.
-
#initialize(component_def) ⇒ ManualPropertyAssembler
constructor
ManualPropertyAssemblerを構築します。 - args 1.
Methods inherited from AbstractAssembler
Constructor Details
#initialize(component_def) ⇒ ManualPropertyAssembler
ManualPropertyAssemblerを構築します。
-
args
-
Seasar::Container::ComponentDef component_def
-
28 29 30 |
# File 'lib/seasar/container/assembler/manual-property-assembler.rb', line 28 def initialize(component_def) super end |
Instance Method Details
#assemble(component) ⇒ Object
マニュアルプロパティインジェクションを実施します。
-
args
-
Object component
-
-
return
-
none
-
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/seasar/container/assembler/manual-property-assembler.rb', line 38 def assemble(component) bean_desc = Seasar::Beans::BeanDescFactory.get_bean_desc(component) prop_descs = bean_desc.typehint_property_descs property_defs = @component_def.get_property_defs @component_def.get_property_defs.each {|property_name, property_def| value = nil if bean_desc.property_descs.key?(property_name) prop_desc = bean_desc.property_descs[property_name] begin value = property_def.value rescue Seasar::Container::Exception::TooManyRegistrationRuntimeException => e if prop_desc.array_acceptable child_component_defs = property_def.container.get_component_def(property_def.value).component_defs value = [] for child_component_def in child_component_defs value << child_component_def.component end else raise e end end prop_desc.set_value(component, value) else raise Seasar::Exception::PropertyNotFoundRuntimeException.new(@component_def.component_class, property_name) end } end |