root/trunk/src/main/php/net/stubbles/xml/serializer/annotations/stubXMLAttributeAnnotation.php

Revision 1301, 1.9 kB (checked in by richi, 4 months ago)

coding standards: fixed coding standards issues (function docblock)

Line 
1 <?php
2 /**
3  * Annotation for XMLSerializer
4  *
5  * @author      Stephan Schmidt <schst@stubbles.net>
6  * @package     stubbles
7  * @subpackage  xml_serializer_annotations
8  */
9 stubClassLoader::load('net::stubbles::reflection::annotations::stubAnnotation',
10                       'net::stubbles::reflection::annotations::stubAbstractAnnotation'
11 );
12 /**
13  * Annotation for XMLSerializer
14  *
15  * Use this annotation to serialize a value as an XML attribute.
16  *
17  * Properties of the annotation are:
18  * - attributeName
19  *
20  * @package     stubbles
21  * @subpackage  xml_serializer_annotations
22  */
23 class stubXMLAttributeAnnotation extends stubAbstractAnnotation implements stubAnnotation
24 {
25     /**
26      * Name of the XML attribute
27      *
28      * @var  string
29      */
30     protected $attributeName;
31     /**
32      * Whether an empty value should be skipped
33      *
34      * @var  boolean
35      */
36     protected $skipEmpty = true;
37     /**
38      * Set the attribute name
39      *
40      * @param  string  $attributeName
41      */
42     public function setAttributeName($attributeName)
43     {
44         $this->attributeName = $attributeName;
45     }
46
47     /**
48      * Set the skipEmpty behaviour
49      *
50      * @param  boolean  $skipEmpty
51      */
52     public function setSkipEmpty($skipEmpty)
53     {
54         $this->skipEmpty = $skipEmpty;
55     }
56
57     /**
58      * Get the name for the attribute
59      *
60      * @return  string
61      */
62     public function getAttributeName()
63     {
64         return $this->attributeName;
65     }
66
67     /**
68      * Check, whether empty values should be skipped
69      *
70      * @return  boolean
71      */
72     public function shouldSkipEmpty()
73     {
74         return $this->skipEmpty;
75     }
76
77     /**
78      * Returns the target of the annotation as bitmap.
79      *
80      * @return  int
81      */
82     public function getAnnotationTarget()
83     {
84         return stubAnnotation::TARGET_FUNCTION + stubAnnotation::TARGET_METHOD + stubAnnotation::TARGET_PROPERTY;
85     }
86 }
87 ?>
Note: See TracBrowser for help on using the browser.