Class: Seasar::Container::ComponentDef
- Inherits:
-
Object
- Object
- Seasar::Container::ComponentDef
- Defined in:
- lib/seasar/container/component-def.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#autobinding_def ⇒ Object
Returns the value of attribute autobinding_def.
-
#component_class ⇒ Object
Returns the value of attribute component_class.
-
#component_name ⇒ Object
Returns the value of attribute component_name.
-
#constructor(&block) ⇒ Object
-
args 1.
-
-
#container ⇒ Object
Returns the value of attribute container.
-
#destructor(&block) ⇒ Object
-
args 1.
-
-
#instance_def ⇒ Object
Returns the value of attribute instance_def.
-
#onetime_proc ⇒ Object
Returns the value of attribute onetime_proc.
Instance Method Summary collapse
-
#add_arg_def(arg_def) ⇒ Object
-
args 1.
-
-
#add_aspect_def(aspect_def) ⇒ Object
-
args 1.
-
-
#add_property_def(property_def) ⇒ Object
-
args 1.
-
-
#destroy ⇒ Object
-
args - none - return - none.
-
-
#get_arg_def(index) ⇒ Object
-
args 1.
-
-
#get_arg_def_size ⇒ Object
-
args - none - return - Integer.
-
-
#get_arg_defs ⇒ Object
-
args - none - return - Array.
-
-
#get_aspect_def(index) ⇒ Object
-
args 1.
-
-
#get_aspect_def_size ⇒ Object
-
args - none - return - Integer.
-
-
#get_component ⇒ Object
(also: #component)
-
args - none - return - Object.
-
-
#get_component_deployer ⇒ Object
-
args - none - return - Seasar::Container::Deployer::AbstractComponentDeployer.
-
-
#get_concreate_class ⇒ Object
-
args - none - return - Class.
-
-
#get_property_def(property_name) ⇒ Object
-
args 1.
-
-
#get_property_def_size ⇒ Object
-
args - none - return - Integer.
-
-
#get_property_defs ⇒ Object
-
args - none - return - Array.
-
-
#has_property_def(property_name) ⇒ Object
-
args 1.
-
-
#init ⇒ Object
-
args - none - return - none.
-
-
#initialize(component_class, component_name = nil, &block) ⇒ ComponentDef
constructor
-
args 1.
-
Constructor Details
#initialize(component_class, component_name = nil, &block) ⇒ ComponentDef
-
args
-
Class component_class
-
String|Symbol component_name
-
Proc block
-
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/seasar/container/component-def.rb', line 27 def initialize(component_class, component_name = nil, &block) @constructor = block @onetime_proc = nil @container = nil @component_class = component_class @concreate_class = nil @component_name = component_name.nil? ? Seasar::Util::ClassUtil.ub_name(component_class) : component_name @component_deployer = nil @arg_defs = [] @property_defs = {} @aspect_defs = [] @instance_def = Seasar::Container::Deployer::InstanceDefFactory.get_instance_def(InstanceDef::SINGLETON_NAME) @autobinding_def = Seasar::Container::Assembler::AutoBindingDefFactory.get_autobinding_def(AutoBindingDef::AUTO_NAME) end |
Instance Attribute Details
#autobinding_def ⇒ Object
Returns the value of attribute autobinding_def.
41 42 43 |
# File 'lib/seasar/container/component-def.rb', line 41 def autobinding_def @autobinding_def end |
#component_class ⇒ Object
Returns the value of attribute component_class.
41 42 43 |
# File 'lib/seasar/container/component-def.rb', line 41 def component_class @component_class end |
#component_name ⇒ Object
Returns the value of attribute component_name.
41 42 43 |
# File 'lib/seasar/container/component-def.rb', line 41 def component_name @component_name end |
#constructor(&block) ⇒ Object
-
args
-
Proc|nil block
-
-
return
-
Proc
-
50 51 52 |
# File 'lib/seasar/container/component-def.rb', line 50 def constructor @constructor end |
#container ⇒ Object
Returns the value of attribute container.
41 42 43 |
# File 'lib/seasar/container/component-def.rb', line 41 def container @container end |
#destructor(&block) ⇒ Object
-
args
-
Proc|nil block
-
-
return
-
Proc
-
63 64 65 |
# File 'lib/seasar/container/component-def.rb', line 63 def destructor @destructor end |
#instance_def ⇒ Object
Returns the value of attribute instance_def.
41 42 43 |
# File 'lib/seasar/container/component-def.rb', line 41 def instance_def @instance_def end |
#onetime_proc ⇒ Object
Returns the value of attribute onetime_proc.
42 43 44 |
# File 'lib/seasar/container/component-def.rb', line 42 def onetime_proc @onetime_proc end |
Instance Method Details
#add_arg_def(arg_def) ⇒ Object
-
args
-
Seasar::Container::ArgDef arg_def
-
-
return
-
none
-
140 141 142 143 144 145 |
# File 'lib/seasar/container/component-def.rb', line 140 def add_arg_def(arg_def) if arg_def.container.nil? arg_def.container = @container end @arg_defs << arg_def end |
#add_aspect_def(aspect_def) ⇒ Object
-
args
-
Seasar::Container::AspectDef aspect_def
-
-
return
-
none
-
236 237 238 239 240 241 242 |
# File 'lib/seasar/container/component-def.rb', line 236 def add_aspect_def(aspect_def) @concreate_class = nil if aspect_def.container.nil? aspect_def.container = @container end @aspect_defs << aspect_def end |
#add_property_def(property_def) ⇒ Object
-
args
-
Seasar::Container::PropertyDef property_def
-
-
return
-
none
-
203 204 205 206 207 208 |
# File 'lib/seasar/container/component-def.rb', line 203 def add_property_def(property_def) if property_def.container.nil? property_def.container = @container end @property_defs[property_def.property_name] = property_def end |
#destroy ⇒ Object
-
args
-
none
-
-
return
-
none
-
86 87 88 |
# File 'lib/seasar/container/component-def.rb', line 86 def destroy return self.get_component_deployer.destroy end |
#get_arg_def(index) ⇒ Object
-
args
-
Integer index
-
-
return
-
Seasar::Container::ArgDef
-
120 121 122 |
# File 'lib/seasar/container/component-def.rb', line 120 def get_arg_def(index) return @arg_defs[index] end |
#get_arg_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
130 131 132 |
# File 'lib/seasar/container/component-def.rb', line 130 def get_arg_def_size return @arg_defs.length end |
#get_arg_defs ⇒ Object
-
args
-
none
-
-
return
-
Array
-
153 154 155 |
# File 'lib/seasar/container/component-def.rb', line 153 def get_arg_defs return @arg_defs end |
#get_aspect_def(index) ⇒ Object
-
args
-
Integer index
-
-
return
-
Seasar::Container::AspectDef
-
216 217 218 |
# File 'lib/seasar/container/component-def.rb', line 216 def get_aspect_def(index) return @aspect_defs[index] end |
#get_aspect_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
226 227 228 |
# File 'lib/seasar/container/component-def.rb', line 226 def get_aspect_def_size() return @aspect_defs.length end |
#get_component ⇒ Object Also known as: component
-
args
-
none
-
-
return
-
Object
-
96 97 98 |
# File 'lib/seasar/container/component-def.rb', line 96 def get_component return self.get_component_deployer.deploy end |
#get_component_deployer ⇒ Object
-
args
-
none
-
-
return
-
Seasar::Container::Deployer::AbstractComponentDeployer
-
250 251 252 253 254 255 |
# File 'lib/seasar/container/component-def.rb', line 250 def get_component_deployer if @component_deployer.nil? @component_deployer = @instance_def.create_component_deployer(self) end return @component_deployer end |
#get_concreate_class ⇒ Object
-
args
-
none
-
-
return
-
Class
-
263 264 265 266 267 268 269 270 271 272 |
# File 'lib/seasar/container/component-def.rb', line 263 def get_concreate_class if @aspect_defs.length == 0 return @component_class end if not @concreate_class.nil? return @concreate_class end @concreate_class = Seasar::Aop::S2AopFactory.create(@component_class, @aspect_defs.map {|aspect_def| aspect_def.aspect}) return @concreate_class end |
#get_property_def(property_name) ⇒ Object
-
args
-
String property_name
-
-
return
-
Seasar::Container::PropertyDef
-
173 174 175 |
# File 'lib/seasar/container/component-def.rb', line 173 def get_property_def(property_name) return @property_defs[property_name] end |
#get_property_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
193 194 195 |
# File 'lib/seasar/container/component-def.rb', line 193 def get_property_def_size return @property_defs.length end |
#get_property_defs ⇒ Object
-
args
-
none
-
-
return
-
Array
-
183 184 185 |
# File 'lib/seasar/container/component-def.rb', line 183 def get_property_defs return @property_defs end |
#has_property_def(property_name) ⇒ Object
-
args
-
Symbol property_name
-
-
return
-
Boolean
-
163 164 165 |
# File 'lib/seasar/container/component-def.rb', line 163 def has_property_def(property_name) return @property_defs.key?(property_name) end |
#init ⇒ Object
-
args
-
none
-
-
return
-
none
-
76 77 78 |
# File 'lib/seasar/container/component-def.rb', line 76 def init return self.get_component_deployer.init end |