1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AppserverIo\Psr\EnterpriseBeans\Annotations\Stateless |
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/epb |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Psr\EnterpriseBeans\Annotations; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Annotation implementation representing a @Stateless annotation on a bean. |
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"}) |
34
|
|
|
*/ |
35
|
|
View Code Duplication |
class Stateless extends AbstractBeanAnnotation |
|
|
|
|
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The value of the bean interface attribute. |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $beanInterface; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The value of the bean name attribute. |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $beanName; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The constructor the initializes the instance with the |
54
|
|
|
* data passed with the token. |
55
|
|
|
* |
56
|
|
|
* @param array $values The annotation values |
57
|
|
|
*/ |
58
|
|
|
public function __construct(array $values = array()) |
59
|
|
|
{ |
60
|
|
|
|
61
|
|
|
// set the bean interface attribute, if available |
62
|
|
|
if (isset($values[AnnotationKeys::BEAN_INTERFACE])) { |
63
|
|
|
$this->beanInterface = $values[AnnotationKeys::BEAN_INTERFACE]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
// set the bean interface attribute, if available |
67
|
|
|
if (isset($values[AnnotationKeys::BEAN_NAME])) { |
68
|
|
|
$this->beanName = $values[AnnotationKeys::BEAN_NAME]; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
// pass the values through to the parent constructor |
72
|
|
|
parent::__construct($values); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Returns the value of the bean interface attribute. |
77
|
|
|
* |
78
|
|
|
* @return string|null The annotations bean interface attribute |
79
|
|
|
*/ |
80
|
|
|
public function getBeanInterface() |
81
|
|
|
{ |
82
|
|
|
return $this->beanInterface; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Returns the value of the bean name attribute. |
87
|
|
|
* |
88
|
|
|
* @return string|null The annotations bean Name attribute |
89
|
|
|
*/ |
90
|
|
|
public function getBeanName() |
91
|
|
|
{ |
92
|
|
|
return $this->beanName; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.