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/02/13 02:40:35 UTC

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

Author: simonetripodi
Date: Sun Feb 13 01:40:35 2011
New Revision: 1070176

URL: http://svn.apache.org/viewvc?rev=1070176&view=rev
Log:
added an utility method to extract the namespaceURI() property from a digester annotation

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

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java?rev=1070176&r1=1070175&r2=1070176&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java Sun Feb 13 01:40:35 2011
@@ -37,6 +37,11 @@ public class Annotations {
     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 Annotations() {
@@ -68,6 +73,20 @@ public class Annotations {
     }
 
     /**
+     * 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.
      *