1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AppserverIo\Psr\EnterpriseBeans\Annotations\Inject |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/appserver-io-psr/apb |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Psr\EnterpriseBeans\Annotations; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Annotation implementation representing a @Inject annotation on a class method/property. |
25
|
|
|
* |
26
|
|
|
* @author Tim Wagner <[email protected]> |
27
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
29
|
|
|
* @link https://github.com/appserver-io-psr/epb |
30
|
|
|
* @link http://www.appserver.io |
31
|
|
|
* |
32
|
|
|
* @Annotation |
33
|
|
|
* @Target({"CLASS", "METHOD","PROPERTY"}) |
34
|
|
|
*/ |
35
|
|
|
class Inject extends AbstractBeanAnnotation |
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The value of the bean name attribute. |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $beanName; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The value of the factory attribute. |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $factory; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The value of the factory method attribute. |
54
|
|
|
* |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
protected $factoryMethod; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The value of the factory type attribute. |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $factoryType; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The value of the type attribute. |
68
|
|
|
* |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
protected $type; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The constructor the initializes the instance with the |
75
|
|
|
* data passed with the token. |
76
|
|
|
* |
77
|
|
|
* @param array $values The annotation values |
78
|
|
|
*/ |
79
|
|
|
public function __construct(array $values = array()) |
80
|
|
|
{ |
81
|
|
|
|
82
|
|
|
// set the bean name attribute, if available |
83
|
|
|
if (isset($values[AnnotationKeys::BEAN_NAME])) { |
84
|
|
|
$this->beanName = $values[AnnotationKeys::BEAN_NAME]; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
// set the type attribute, if available |
88
|
|
|
if (isset($values[AnnotationKeys::TYPE])) { |
89
|
|
|
$this->type = $values[AnnotationKeys::TYPE]; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
// set the factory attribute, if available |
93
|
|
|
if (isset($values[AnnotationKeys::FACTORY])) { |
94
|
|
|
$this->factory = $values[AnnotationKeys::FACTORY]; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
// set the factory type attribute, if available |
98
|
|
|
if (isset($values[AnnotationKeys::FACTORY_TYPE])) { |
99
|
|
|
$this->factoryType = $values[AnnotationKeys::FACTORY_TYPE]; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
// set the factory method attribute, if available |
103
|
|
|
if (isset($values[AnnotationKeys::FACTORY_METHOD])) { |
104
|
|
|
$this->factoryMethod = $values[AnnotationKeys::FACTORY_METHOD]; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
// pass the values through to the parent constructor |
108
|
|
|
parent::__construct($values); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Returns the value of the bean name attribute. |
113
|
|
|
* |
114
|
|
|
* @return string|null The annotations bean Name attribute |
115
|
|
|
*/ |
116
|
|
|
public function getBeanName() |
117
|
|
|
{ |
118
|
|
|
return $this->beanName; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Returns the value of the type attribute. |
123
|
|
|
* |
124
|
|
|
* @return string The annotations type attribute |
125
|
|
|
*/ |
126
|
|
|
public function getType() |
127
|
|
|
{ |
128
|
|
|
return $this->type; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Returns the value of the factory attribute. |
133
|
|
|
* |
134
|
|
|
* @return string The annotations factory attribute |
135
|
|
|
*/ |
136
|
|
|
public function getFactory() |
137
|
|
|
{ |
138
|
|
|
return $this->factory; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Returns the value of the factory type attribute. |
143
|
|
|
* |
144
|
|
|
* @return string The annotations factory type attribute |
145
|
|
|
*/ |
146
|
|
|
public function getFactoryType() |
147
|
|
|
{ |
148
|
|
|
return $this->factoryType; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Returns the value of the factory method attribute. |
153
|
|
|
* |
154
|
|
|
* @return string The annotations factory method attribute |
155
|
|
|
*/ |
156
|
|
|
public function getFactoryMethod() |
157
|
|
|
{ |
158
|
|
|
return $this->factoryMethod; |
159
|
|
|
} |
160
|
|
|
} |
161
|
|
|
|