You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/24 07:53:42 UTC

svn commit: r1126878 - /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java

Author: simonetripodi
Date: Tue May 24 05:53:42 2011
New Revision: 1126878

URL: http://svn.apache.org/viewvc?rev=1126878&view=rev
Log:
added method to extract the namespaceURI property from the Digester annotation, if present

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java?rev=1126878&r1=1126877&r2=1126878&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java Tue May 24 05:53:42 2011
@@ -40,6 +40,11 @@ public class AnnotationUtils
     private static final String PATTERN = "pattern";
 
     /**
+     * The {@code namespaceURI} string constant.
+     */
+    private static final String NAMESPACE_URI = "namespaceURI";
+
+    /**
      * This class can't be instantiated.
      */
     private AnnotationUtils()
@@ -75,6 +80,22 @@ public class AnnotationUtils
     }
 
     /**
+     * Extract the {@code namespaceURI()} from annotation.
+     *
+     * @param annotation The annotation has to be introspected
+     * @return The annotation {@code namespaceURI()}
+     */
+    public static String getAnnotationNamespaceURI( Annotation annotation )
+    {
+        Object ret = invokeAnnotationMethod( annotation, NAMESPACE_URI );
+        if ( ret != null )
+        {
+            return (String) ret;
+        }
+        return null;
+    }
+
+    /**
      * Extract the Annotations array {@code value()} from annotation if present, nul otherwise.
      * 
      * @param annotation the annotation has to be introspected.