@@ 9-29 (lines=21) @@ | ||
6 | ||
7 | module AMA |
|
8 | module Entity |
|
9 | class Mapper |
|
10 | module API |
|
11 | # Class that proxies attribute setting on target entity. That allows |
|
12 | # tricks like virtual attribute handling or multi-value attribute |
|
13 | # handling (like in hash or array) |
|
14 | class Injector < Interface |
|
15 | # :nocov: |
|
16 | # Injects passed attribute into entity. |
|
17 | # |
|
18 | # @param [Object] entity |
|
19 | # @param [AMA::Entity::Mapper::Type] type |
|
20 | # @param [AMA::Entity::Mapper::Type::Attribute] attribute |
|
21 | # @param [Object] value |
|
22 | # @param [AMA::Entity::Mapper::Context] context |
|
23 | def inject(entity, type, attribute, value, context = nil) |
|
24 | abstract_method |
|
25 | end |
|
26 | # :nocov: |
|
27 | end |
|
28 | end |
|
29 | end |
|
30 | end |
|
31 | end |
|
32 |
@@ 9-28 (lines=20) @@ | ||
6 | ||
7 | module AMA |
|
8 | module Entity |
|
9 | class Mapper |
|
10 | module API |
|
11 | # This interface depicts factory for class instance creation. |
|
12 | class Factory < Interface |
|
13 | # :nocov: |
|
14 | # @param [AMA::Entity::Mapper::Type] type Type that requires creation. |
|
15 | # While most probably it wouldn't be necessary, it is unknown until |
|
16 | # creation which exact type will be used (altering type parameters |
|
17 | # results in new type creation) |
|
18 | # @param [Object] data Data that will be used for object creation. |
|
19 | # May be of any type or even nil. |
|
20 | # @param [AMA::Entity::Mapper::Context] context |
|
21 | # @return [Object] Object of passed type. |
|
22 | def create(type, data = nil, context = nil) |
|
23 | abstract_method |
|
24 | end |
|
25 | # :nocov: |
|
26 | end |
|
27 | end |
|
28 | end |
|
29 | end |
|
30 | end |
|
31 |