Author: simonetripodi
Date: Thu Oct 28 21:25:23 2010
New Revision: 1028490

URL: http://svn.apache.org/viewvc?rev=1028490&view=rev
Log:
first checkin of privileged actions to extract declared fields and methods from 
a class

Added:
    
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
   (with props)
    
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
   (with props)
    
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
   (with props)

Added: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
URL: 
http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java?rev=1028490&view=auto
==============================================================================
--- 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
 (added)
+++ 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
 Thu Oct 28 21:25:23 2010
@@ -0,0 +1,45 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.digester.annotations.internal;
+
+import java.lang.reflect.AnnotatedElement;
+import java.security.PrivilegedAction;
+
+/**
+ * Abstract {...@link PrivilegedAction} to extract annotated elements from a 
type.
+ *
+ * @since 2.2
+ */
+abstract class AbstractAnnotatedElementPrivilegedAction<A extends 
AnnotatedElement> implements PrivilegedAction<A[]> {
+
+    private final Class<?> type;
+
+    public AbstractAnnotatedElementPrivilegedAction(Class<?> type) {
+        this.type = type;
+    }
+
+    protected final Class<?> getType() {
+        return this.type;
+    }
+
+    /**
+     * {...@inheritdoc}
+     */
+    public abstract A[] run();
+
+}

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/AbstractAnnotatedElementPrivilegedAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
URL: 
http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java?rev=1028490&view=auto
==============================================================================
--- 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
 (added)
+++ 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
 Thu Oct 28 21:25:23 2010
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.digester.annotations.internal;
+
+import java.lang.reflect.Field;
+
+/**
+ * Privileged action to extract declared fields of a class.
+ *
+ * @version $Id$
+ */
+public final class GetDeclaredFieldsPrivilegedAction extends 
AbstractAnnotatedElementPrivilegedAction<Field> {
+
+    public GetDeclaredFieldsPrivilegedAction(Class<?> type) {
+        super(type);
+    }
+
+    /**
+     * {...@inheritdoc}
+     */
+    @Override
+    public Field[] run() {
+        return this.getType().getDeclaredFields();
+    }
+
+}

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredFieldsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
URL: 
http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java?rev=1028490&view=auto
==============================================================================
--- 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
 (added)
+++ 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
 Thu Oct 28 21:25:23 2010
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.digester.annotations.internal;
+
+import java.lang.reflect.Method;
+
+/**
+ * Privileged action to extract declared methods of a class.
+ *
+ * @since 2.2
+ */
+public final class GetDeclaredMethodsPrivilegedAction extends 
AbstractAnnotatedElementPrivilegedAction<Method> {
+
+    public GetDeclaredMethodsPrivilegedAction(Class<?> type) {
+        super(type);
+    }
+
+    /**
+     * {...@inheritdoc}
+     */
+    @Override
+    public Method[] run() {
+        return this.getType().getDeclaredMethods();
+    }
+
+}

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: 
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester/annotations/internal/GetDeclaredMethodsPrivilegedAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to