| @@ 32-132 (lines=101) @@ | ||
| 29 | * @link https://github.com/appserver-io-psr/epb |
|
| 30 | * @link http://www.appserver.io |
|
| 31 | */ |
|
| 32 | abstract class AbstractBeanAnnotation extends AbstractAnnotation |
|
| 33 | { |
|
| 34 | ||
| 35 | /** |
|
| 36 | * The value of the name attribute. |
|
| 37 | * |
|
| 38 | * @var string |
|
| 39 | */ |
|
| 40 | protected $name; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * The value of the description attribute. |
|
| 44 | * |
|
| 45 | * @var string |
|
| 46 | */ |
|
| 47 | protected $description; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * The value of the lookup attribute. |
|
| 51 | * |
|
| 52 | * @var string |
|
| 53 | */ |
|
| 54 | protected $lookup; |
|
| 55 | ||
| 56 | /** |
|
| 57 | * The value of the shared attribute. |
|
| 58 | * |
|
| 59 | * @var boolean |
|
| 60 | */ |
|
| 61 | protected $shared = true; |
|
| 62 | ||
| 63 | /** |
|
| 64 | * The constructor the initializes the instance with the |
|
| 65 | * data passed with the token. |
|
| 66 | * |
|
| 67 | * @param array $values The annotation values |
|
| 68 | */ |
|
| 69 | public function __construct(array $values = array()) |
|
| 70 | { |
|
| 71 | ||
| 72 | // set the name attribute, if available |
|
| 73 | if (isset($values[AnnotationKeys::NAME])) { |
|
| 74 | $this->name = $values[AnnotationKeys::NAME]; |
|
| 75 | } |
|
| 76 | ||
| 77 | // set the description attribute, if available |
|
| 78 | if (isset($values[AnnotationKeys::DESCRIPTION])) { |
|
| 79 | $this->description = $values[AnnotationKeys::DESCRIPTION]; |
|
| 80 | } |
|
| 81 | ||
| 82 | // set the lookup attribute, if available |
|
| 83 | if (isset($values[AnnotationKeys::LOOKUP])) { |
|
| 84 | $this->lookup = $values[AnnotationKeys::LOOKUP]; |
|
| 85 | } |
|
| 86 | ||
| 87 | // set the shared attribute, if available |
|
| 88 | if (isset($values[AnnotationKeys::SHARED])) { |
|
| 89 | $this->shared = $values[AnnotationKeys::SHARED]; |
|
| 90 | } |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Returns the value of the name attribute. |
|
| 95 | * |
|
| 96 | * @return string|null The annotations name attribute |
|
| 97 | */ |
|
| 98 | public function getName() |
|
| 99 | { |
|
| 100 | return $this->name; |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Returns the value of the description attribute. |
|
| 105 | * |
|
| 106 | * @return string|null The annotations description attribute |
|
| 107 | */ |
|
| 108 | public function getDescription() |
|
| 109 | { |
|
| 110 | return $this->description; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Returns the value of the lookup attribute. |
|
| 115 | * |
|
| 116 | * @return string|null The annotations lookup attribute |
|
| 117 | */ |
|
| 118 | public function getLookup() |
|
| 119 | { |
|
| 120 | return $this->lookup; |
|
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * Returns the value of the shared attribute. |
|
| 125 | * |
|
| 126 | * @return boolean The annotations shared attribute |
|
| 127 | */ |
|
| 128 | public function getShared() |
|
| 129 | { |
|
| 130 | return $this->shared; |
|
| 131 | } |
|
| 132 | } |
|
| 133 | ||
| @@ 35-138 (lines=104) @@ | ||
| 32 | * @Annotation |
|
| 33 | * @Target({"CLASS", "METHOD","PROPERTY"}) |
|
| 34 | */ |
|
| 35 | class Resource 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 value of the type attribute. |
|
| 54 | * |
|
| 55 | * @var string |
|
| 56 | */ |
|
| 57 | protected $type; |
|
| 58 | ||
| 59 | /** |
|
| 60 | * The value of the lookup attribute. |
|
| 61 | * |
|
| 62 | * @var string |
|
| 63 | */ |
|
| 64 | protected $lookup; |
|
| 65 | ||
| 66 | /** |
|
| 67 | * The constructor the initializes the instance with the |
|
| 68 | * data passed with the token. |
|
| 69 | * |
|
| 70 | * @param array $values The annotation values |
|
| 71 | */ |
|
| 72 | public function __construct(array $values = array()) |
|
| 73 | { |
|
| 74 | ||
| 75 | // set the bean interface attribute, if available |
|
| 76 | if (isset($values[AnnotationKeys::BEAN_INTERFACE])) { |
|
| 77 | $this->beanInterface = $values[AnnotationKeys::BEAN_INTERFACE]; |
|
| 78 | } |
|
| 79 | ||
| 80 | // set the bean interface attribute, if available |
|
| 81 | if (isset($values[AnnotationKeys::BEAN_NAME])) { |
|
| 82 | $this->beanName = $values[AnnotationKeys::BEAN_NAME]; |
|
| 83 | } |
|
| 84 | ||
| 85 | // set the type attribute, if available |
|
| 86 | if (isset($values[AnnotationKeys::TYPE])) { |
|
| 87 | $this->type = $values[AnnotationKeys::TYPE]; |
|
| 88 | } |
|
| 89 | ||
| 90 | // set the lookup attribute, if available |
|
| 91 | if (isset($values[AnnotationKeys::LOOKUP])) { |
|
| 92 | $this->lookup = $values[AnnotationKeys::LOOKUP]; |
|
| 93 | } |
|
| 94 | ||
| 95 | // pass the values through to the parent constructor |
|
| 96 | parent::__construct($values); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Returns the value of the bean interface attribute. |
|
| 101 | * |
|
| 102 | * @return string|null The annotations bean interface attribute |
|
| 103 | */ |
|
| 104 | public function getBeanInterface() |
|
| 105 | { |
|
| 106 | return $this->beanInterface; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Returns the value of the bean name attribute. |
|
| 111 | * |
|
| 112 | * @return string|null The annotations bean Name attribute |
|
| 113 | */ |
|
| 114 | public function getBeanName() |
|
| 115 | { |
|
| 116 | return $this->beanName; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Returns the value of the type attribute. |
|
| 121 | * |
|
| 122 | * @return string The annotations type attribute |
|
| 123 | */ |
|
| 124 | public function getType() |
|
| 125 | { |
|
| 126 | return $this->type; |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * Returns the value of the lookup name attribute. |
|
| 131 | * |
|
| 132 | * @return string|null The annotations lookup name attribute |
|
| 133 | */ |
|
| 134 | public function getLookup() |
|
| 135 | { |
|
| 136 | return $this->lookup; |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||