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/12 17:07:17 UTC
svn commit: r1070101 [2/2] - in
/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations:
./ handlers/ reflect/ rules/ spi/ utils/
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,92 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.CallParamHandler;
+import org.apache.commons.digester3.rule.CallParamRule;
+
+/**
+ * Methods arguments annotated with {@code CallParam} will be bound with
+ * {@code CallParamRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@DigesterRule(
+ reflectsRule = CallParamRule.class,
+ handledBy = CallParamHandler.class
+)
+public @interface CallParam {
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern
+ */
+ String pattern();
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ *
+ * @return the namespace URI for which this Rule is relevant, if any
+ */
+ String namespaceURI() default "";
+
+ /**
+ * The attribute from which to save the parameter value.
+ *
+ * @return the attribute from which to save the parameter value
+ */
+ String attributeName() default "";
+
+ /**
+ * Flags the parameter to be set from the stack.
+ *
+ * @return true if the parameter has to be set from the stack, false otherwise
+ */
+ boolean fromStack() default false;
+
+ /**
+ * Sets the position of the object from the top of the stack.
+ *
+ * @return The position of the object from the top of the stack
+ */
+ int stackIndex() default 0;
+
+ /**
+ * Defines several {@code @CallParam} annotations on the same element.
+ *
+ * @see CallParam
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ CallParam[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CallParam.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,35 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a Digester rule as a creation rule, that's crucial for the
+ * {@code setNext} rule.
+ */
+@Documented
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CreationRule {
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,95 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.FactoryCreateHandler;
+import org.apache.commons.digester3.rule.FactoryCreateRule;
+import org.apache.commons.digester3.spi.ObjectCreationFactory;
+
+/**
+ * Classes annotated with {@code FactoryCreate} will be bound with
+ * {@code FactoryCreateRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@CreationRule
+@DigesterRule(
+ reflectsRule = FactoryCreateRule.class,
+ handledBy = FactoryCreateHandler.class
+)
+public @interface FactoryCreate {
+
+ /**
+ * The Java class of the object creation factory class.
+ *
+ * @return the Java class of the object creation factory class
+ */
+ Class<? extends ObjectCreationFactory<?>> factoryClass();
+
+ /**
+ * Allows specify the attribute containing an override class name if it is present.
+ *
+ * @return The attribute containing an override class name if it is present
+ */
+ String attributeName() default "";
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern
+ */
+ String pattern();
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ *
+ * @return The namespace URI for which this Rule is relevant, if any
+ */
+ String namespaceURI() default "";
+
+ /**
+ * When true any exceptions thrown during object creation will be ignored.
+ *
+ * @return when true any exceptions thrown during object creation will be
+ * ignored.
+ */
+ boolean ignoreCreateExceptions() default false;
+
+ /**
+ * Defines several {@code @FactoryCreate} annotations on the same element.
+ *
+ * @see FactoryCreate
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ FactoryCreate[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/FactoryCreate.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,77 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.ObjectCreateHandler;
+import org.apache.commons.digester3.rule.ObjectCreateRule;
+
+/**
+ * Classes annotated with {@code ObjectCreate} will be bound with
+ * {@code ObjectCreateRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@CreationRule
+@DigesterRule(
+ reflectsRule = ObjectCreateRule.class,
+ handledBy = ObjectCreateHandler.class
+)
+public @interface ObjectCreate {
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern.
+ */
+ String pattern();
+
+ /**
+ * Allows specify the attribute containing an override class name if it is present.
+ *
+ * @return The attribute containing an override class name if it is present
+ */
+ String attributeName() default "";
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ */
+ String namespaceURI() default "";
+
+ /**
+ * Defines several {@code @ObjectCreate} annotations on the same element.
+ *
+ * @see ObjectCreate
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ ObjectCreate[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/ObjectCreate.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,69 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.PathCallParamHandler;
+import org.apache.commons.digester3.rule.PathCallParamRule;
+
+/**
+ * Methods arguments annotated with {@code PathCallParam} will be bound
+ * with {@code PathCallParamRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@DigesterRule(
+ reflectsRule = PathCallParamRule.class,
+ handledBy = PathCallParamHandler.class
+)
+public @interface PathCallParam {
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern.
+ */
+ String pattern();
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ */
+ String namespaceURI() default "";
+
+ /**
+ * Defines several {@code @PathCallParam} annotations on the same element.
+ *
+ * @see PathCallParam
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ PathCallParam[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/PathCallParam.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,52 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.handlers.SetNextHandler;
+import org.apache.commons.digester3.rule.SetNextRule;
+
+/**
+ * Methods annotated with {@code SetNext} will be bound
+ * with {@code SetNextRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@DigesterRule(
+ reflectsRule = SetNextRule.class,
+ handledBy = SetNextHandler.class
+)
+public @interface SetNext {
+
+ /**
+ * Defines the concrete implementation(s) of @SetNext annotated method
+ * argument.
+ *
+ * @return the concrete implementation(s) of @SetNext annotated method
+ * argument.
+ */
+ Class<?>[] value() default {};
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetNext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,76 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.SetPropertiesHandler;
+import org.apache.commons.digester3.rule.SetPropertiesRule;
+
+/**
+ * Fields annotated with {@code SetProperty} will be bound
+ * with {@code SetPropertiesRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+@DigesterRule(
+ reflectsRule = SetPropertiesRule.class,
+ handledBy = SetPropertiesHandler.class
+)
+public @interface SetProperty {
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern.
+ */
+ String pattern();
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ */
+ String namespaceURI() default "";
+
+ /**
+ * The overridden parameter.
+ *
+ * @return the overridden parameter.
+ */
+ String attributeName() default "";
+
+ /**
+ * Defines several {@code @SetProperty} annotations on the same element.
+ *
+ * @see SetProperty
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ SetProperty[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetProperty.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,52 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.handlers.SetRootHandler;
+import org.apache.commons.digester3.rule.SetRootRule;
+
+/**
+ * Methods annotated with {@code SetRoot} will be bound
+ * with {@code SetRootRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@DigesterRule(
+ reflectsRule = SetRootRule.class,
+ handledBy = SetRootHandler.class
+)
+public @interface SetRoot {
+
+ /**
+ * Defines the concrete implementation(s) of @SetRoot annotated method
+ * argument.
+ *
+ * @return the concrete implementation(s) of @SetRoot annotated method
+ * argument.
+ */
+ Class<?>[] value() default {};
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetRoot.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,69 @@
+/* $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.digester3.annotations.rules;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.annotations.DigesterRuleList;
+import org.apache.commons.digester3.annotations.handlers.SetTopHandler;
+import org.apache.commons.digester3.rule.SetTopRule;
+
+/**
+ * Methods annotated with {@code SetTop} will be bound
+ * with {@code SetTopRule} digester rule.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@DigesterRule(
+ reflectsRule = SetTopRule.class,
+ handledBy = SetTopHandler.class
+)
+public @interface SetTop {
+
+ /**
+ * The element matching pattern.
+ *
+ * @return the element matching pattern.
+ */
+ String pattern();
+
+ /**
+ * The namespace URI for which this Rule is relevant, if any.
+ */
+ String namespaceURI() default "";
+
+ /**
+ * Defines several {@code @SetTop} annotations on the same element
+ *
+ * @see SetTop
+ */
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @DigesterRuleList
+ @interface List {
+ SetTop[] value();
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/SetTop.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,22 @@
+/* $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.
+ */
+
+/**
+ * Classes contained in this package are annotations that reflect Digester rules.
+ */
+package org.apache.commons.digester3.annotations.rules;
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,43 @@
+/* $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.digester3.annotations.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.DigesterLoadingException;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+
+/**
+ * An object capable of providing instances of {@link AnnotationHandler}.
+ */
+public interface AnnotationHandlerFactory {
+
+ /**
+ * Return an instance of the specified type.
+ *
+ * @param <H>
+ * @param type the class of the object to be returned.
+ * @return an instance of the specified class.
+ * @throws DigesterLoadingException if any error occurs while creating the
+ * {@code type} instance.
+ */
+ <H extends AnnotationHandler<? extends Annotation, ? extends AnnotatedElement>> H newInstance(
+ Class<H> type) throws Exception;
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/AnnotationHandlerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,22 @@
+/* $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.
+ */
+
+/**
+ * Contains annotations package SPI definition.
+ */
+package org.apache.commons.digester3.annotations.spi;
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/spi/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,83 @@
+/* $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.digester3.annotations.utils;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.commons.beanutils.MethodUtils;
+
+/**
+ * Simple utility class to introspect annotations.
+ */
+public class Annotations {
+
+ /**
+ * The {@code value} string constant.
+ */
+ private static final String VALUE = "value";
+
+ /**
+ * This class can't be instantiated.
+ */
+ private Annotations() {
+ // this class can' be instantiated
+ }
+
+ /**
+ * Extract the {@code value()} from annotation.
+ *
+ * @param annotation the annotation has to be introspected.
+ * @return the annotation {@code value()}.
+ */
+ public static Object getAnnotationValue(Annotation annotation) {
+ return invokeAnnotationMethod(annotation, VALUE);
+ }
+
+ /**
+ * Extract the Annotations array {@code value()} from annotation if present,
+ * nul otherwise.
+ *
+ * @param annotation the annotation has to be introspected.
+ * @return the annotation {@code value()} as Annotations array.
+ */
+ public static Annotation[] getAnnotationsArrayValue(Annotation annotation) {
+ Object value = getAnnotationValue(annotation);
+ if (value != null
+ && value.getClass().isArray()
+ && Annotation.class.isAssignableFrom(value.getClass().getComponentType())) {
+ return (Annotation[]) value;
+ }
+ return null;
+ }
+
+ /**
+ * Invokes an annotation method.
+ *
+ * @param annotationn the annotation has to be introspected.
+ * @param method the method name to execute.
+ * @return the annotation method value, null if any error occurs.
+ */
+ private static Object invokeAnnotationMethod(Annotation annotation, String method) {
+ try {
+ return MethodUtils.invokeExactMethod(annotation, method, null);
+ } catch (Throwable t) {
+ return null;
+ }
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/Annotations.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java?rev=1070101&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java Sat Feb 12 16:07:15 2011
@@ -0,0 +1,22 @@
+/* $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.
+ */
+
+/**
+ * Contains commons utilities classes for Java5 Annotations manipulation.
+ */
+package org.apache.commons.digester3.annotations.utils;
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain