001    package org.apache.commons.digester3.annotations.rules;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import java.lang.annotation.Documented;
023    import java.lang.annotation.ElementType;
024    import java.lang.annotation.Retention;
025    import java.lang.annotation.RetentionPolicy;
026    import java.lang.annotation.Target;
027    
028    import org.apache.commons.digester3.SetRootRule;
029    import org.apache.commons.digester3.annotations.DigesterRule;
030    import org.apache.commons.digester3.annotations.handlers.SetRootHandler;
031    
032    /**
033     * Methods annotated with {@code SetRoot} will be bound with {@code SetRootRule} digester rule.
034     * 
035     * @see org.apache.commons.digester3.Digester#addSetRoot(String,String,String)
036     * @since 2.1
037     */
038    @Documented
039    @Retention( RetentionPolicy.RUNTIME )
040    @Target( ElementType.METHOD )
041    @DigesterRule( reflectsRule = SetRootRule.class, handledBy = SetRootHandler.class )
042    public @interface SetRoot
043    {
044    
045        /**
046         * Defines the concrete implementation(s) of @SetRoot annotated method argument.
047         */
048        Class<?>[] value() default { };
049    
050        /**
051         * Marks the rule be invoked when {@code begin} or {@code end} events match.
052         */
053        boolean fireOnBegin() default false;
054    
055    }