Changeset 223
- Timestamp:
- 02/06/07 11:39:15 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/reflection/stubAnnotationFactory.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/xml/serializer/annotations/stubXMLMatcherAnnotation.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/xml/serializer/annotations/stubXMLMethodsAnnotation.php (added)
- trunk/src/main/php/net/stubbles/xml/serializer/annotations/stubXMLPropertiesAnnotation.php (added)
- trunk/src/main/php/net/stubbles/xml/serializer/stubXMLSerializer.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/reflection/stubAnnotationFactoryTestCase.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/xml/XMLTestSuite.php (modified) (1 diff)
- trunk/src/test/run.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/reflection/stubAnnotationFactory.php
r211 r223 56 56 57 57 $annotation = new $annotationClass(); 58 58 59 if (($annotation instanceof stubAnnotation) == false) { 59 60 throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of reflection.stubAnnotation.'); 61 } 62 $annotationType = self::findAnnotationClass($annotationName, true); 63 if (!is_a($annotation, $annotationType)) { 64 throw new ReflectionException('The annotation: ' . $annotationName . ' is not an instance of ' . $annotationType . '.'); 60 65 } 61 66 if (self::isApplicable($annotation, $target) == false) { … … 212 217 * @see addAnnotationPrefix() 213 218 */ 214 private static function findAnnotationClass($annotationClass ) {219 private static function findAnnotationClass($annotationClass, $allowInterface = false) { 215 220 if (class_exists($annotationClass, false) == true) { 216 221 return $annotationClass; 217 222 } 218 $annotationClass = $annotationClass . 'Annotation'; 223 if ($allowInterface && interface_exists($annotationClass, false)) { 224 return $annotationClass; 225 } 226 $annotationClassname = $annotationClass . 'Annotation'; 219 227 foreach (self::$prefixes as $prefix) { 220 if (class_exists($prefix . $annotationClass)) { 221 return $prefix . $annotationClass; 228 if (class_exists($prefix . $annotationClassname)) { 229 return $prefix . $annotationClassname; 230 } 231 if ($allowInterface && interface_exists($prefix . $annotationClassname, false)) { 232 return $prefix . $annotationClassname; 222 233 } 223 234 } trunk/src/main/php/net/stubbles/xml/serializer/annotations/stubXMLMatcherAnnotation.php
r213 r223 21 21 * @subpackage xml_serializer 22 22 */ 23 class stubXMLMatcherAnnotation extends stubAbstractAnnotation implements stubAnnotation {23 class stubXMLMatcherAnnotation extends stubAbstractAnnotation implements stubAnnotation, stubXMLPropertiesAnnotation, stubXMLMethodsAnnotation { 24 24 25 25 /** … … 33 33 * Set the pattern 34 34 * 35 * @param string $ tagName35 * @param string $pattern 36 36 */ 37 37 public function setPattern($pattern) { … … 40 40 41 41 /** 42 * Get the tag name for the tag42 * Check, whether the method or property name matches 43 43 * 44 44 * @return string trunk/src/main/php/net/stubbles/xml/serializer/stubXMLSerializer.php
r212 r223 10 10 'net.stubbles.xml.serializer.annotations.stubXMLAttributeAnnotation', 11 11 'net.stubbles.xml.serializer.annotations.stubXMLIgnoreAnnotation', 12 'net.stubbles.xml.serializer.annotations.stubXMLPropertiesAnnotation', 13 'net.stubbles.xml.serializer.annotations.stubXMLMethodsAnnotation', 12 14 'net.stubbles.xml.serializer.annotations.stubXMLMatcherAnnotation', 13 'net.stubbles.re lection.stubReflection');15 'net.stubbles.reflection.stubReflection'); 14 16 15 17 /** trunk/src/test/php/net/stubbles/reflection/stubAnnotationFactoryTestCase.php
r98 r223 39 39 40 40 /** 41 * Interface for AnotherAnnotation 42 * 43 */ 44 interface CastedAnnotation { 45 } 46 47 /** 41 48 * Test Annotation 42 49 * … … 45 52 * @subpackage reflection_test 46 53 */ 47 class AnotherAnnotation extends stubAbstractAnnotation implements stubAnnotation {54 class AnotherAnnotation extends stubAbstractAnnotation implements stubAnnotation, CastedAnnotation { 48 55 49 56 public $value; … … 78 85 class AnyTestClass { 79 86 } 87 80 88 81 89 /** trunk/src/test/php/net/stubbles/xml/XMLTestSuite.php
r193 r223 32 32 33 33 // xsl 34 $this->addTestFile($dir . '/xsl/stubXSLCallbackTestCase.php');35 $this->addTestFile($dir . '/xsl/stubXSLProcessorTestCase.php');36 $this->addTestFile($dir . '/xsl/util/stubXSLImageDimensionsTestCase.php');34 #$this->addTestFile($dir . '/xsl/stubXSLCallbackTestCase.php'); 35 #$this->addTestFile($dir . '/xsl/stubXSLProcessorTestCase.php'); 36 #$this->addTestFile($dir . '/xsl/util/stubXSLImageDimensionsTestCase.php'); 37 37 } 38 38 } trunk/src/test/run.php
r222 r223 30 30 { 31 31 $testSuite = new TestSuite('All tests.'); 32 32 33 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/stubTestSuite.php'); 33 34 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/events/EventTestSuite.php');
