commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1070175 - /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java
Date Sun, 13 Feb 2011 01:35:02 GMT
Author: simonetripodi
Date: Sun Feb 13 01:35:02 2011
New Revision: 1070175

URL: http://svn.apache.org/viewvc?rev=1070175&view=rev
Log:
added an utility method to extract the pattern() 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=1070175&r1=1070174&r2=1070175&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:35:02 2011
@@ -32,6 +32,11 @@ public class Annotations {
     private static final String VALUE = "value";
 
     /**
+     * The {@code pattern} string constant.
+     */
+    private static final String PATTERN = "pattern";
+
+    /**
      * This class can't be instantiated.
      */
     private Annotations() {
@@ -49,6 +54,20 @@ public class Annotations {
     }
 
     /**
+     * Extract the {@code pattern()} from annotation.
+     *
+     * @param annotation the annotation has to be introspected.
+     * @return the annotation {@code pattern()}.
+     */
+    public static String getAnnotationPattern(Annotation annotation) {
+        Object ret = invokeAnnotationMethod(annotation, PATTERN);
+        if (ret != null) {
+            return (String) ret;
+        }
+        return null;
+    }
+
+    /**
      * Extract the Annotations array {@code value()} from annotation if present,
      * nul otherwise.
      *



Mime
View raw message