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
-
144 145 146 147 148 149 |
# File 'lib/seasar/container/component-def.rb', line 144 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
-
240 241 242 243 244 245 246 |
# File 'lib/seasar/container/component-def.rb', line 240 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
-
207 208 209 210 211 212 |
# File 'lib/seasar/container/component-def.rb', line 207 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
-
88 89 90 91 92 |
# File 'lib/seasar/container/component-def.rb', line 88 def destroy @concreate_class = nil @onetime_proc = nil return self.get_component_deployer.destroy end |
#get_arg_def(index) ⇒ Object
-
args
-
Integer index
-
-
return
-
Seasar::Container::ArgDef
-
124 125 126 |
# File 'lib/seasar/container/component-def.rb', line 124 def get_arg_def(index) return @arg_defs[index] end |
#get_arg_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
134 135 136 |
# File 'lib/seasar/container/component-def.rb', line 134 def get_arg_def_size return @arg_defs.length end |
#get_arg_defs ⇒ Object
-
args
-
none
-
-
return
-
Array
-
157 158 159 |
# File 'lib/seasar/container/component-def.rb', line 157 def get_arg_defs return @arg_defs end |
#get_aspect_def(index) ⇒ Object
-
args
-
Integer index
-
-
return
-
Seasar::Container::AspectDef
-
220 221 222 |
# File 'lib/seasar/container/component-def.rb', line 220 def get_aspect_def(index) return @aspect_defs[index] end |
#get_aspect_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
230 231 232 |
# File 'lib/seasar/container/component-def.rb', line 230 def get_aspect_def_size() return @aspect_defs.length end |
#get_component ⇒ Object Also known as: component
-
args
-
none
-
-
return
-
Object
-
100 101 102 |
# File 'lib/seasar/container/component-def.rb', line 100 def get_component return self.get_component_deployer.deploy end |
#get_component_deployer ⇒ Object
-
args
-
none
-
-
return
-
Seasar::Container::Deployer::AbstractComponentDeployer
-
254 255 256 257 258 259 |
# File 'lib/seasar/container/component-def.rb', line 254 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
-
267 268 269 270 271 272 273 274 275 276 |
# File 'lib/seasar/container/component-def.rb', line 267 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
-
177 178 179 |
# File 'lib/seasar/container/component-def.rb', line 177 def get_property_def(property_name) return @property_defs[property_name] end |
#get_property_def_size ⇒ Object
-
args
-
none
-
-
return
-
Integer
-
197 198 199 |
# File 'lib/seasar/container/component-def.rb', line 197 def get_property_def_size return @property_defs.length end |
#get_property_defs ⇒ Object
-
args
-
none
-
-
return
-
Array
-
187 188 189 |
# File 'lib/seasar/container/component-def.rb', line 187 def get_property_defs return @property_defs end |
#has_property_def(property_name) ⇒ Object
-
args
-
Symbol property_name
-
-
return
-
Boolean
-
167 168 169 |
# File 'lib/seasar/container/component-def.rb', line 167 def has_property_def(property_name) return @property_defs.key?(property_name) end |
#init ⇒ Object
-
args
-
none
-
-
return
-
none
-
76 77 78 79 80 |
# File 'lib/seasar/container/component-def.rb', line 76 def init @concreate_class = nil @onetime_proc = nil return self.get_component_deployer.init end |