001package 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
022import java.lang.annotation.Documented;
023import java.lang.annotation.ElementType;
024import java.lang.annotation.Retention;
025import java.lang.annotation.RetentionPolicy;
026import java.lang.annotation.Target;
027
028import org.apache.commons.digester3.SetPropertiesRule;
029import org.apache.commons.digester3.annotations.DigesterRule;
030import org.apache.commons.digester3.annotations.DigesterRuleList;
031import org.apache.commons.digester3.annotations.handlers.SetPropertiesHandler;
032
033/**
034 * Fields annotated with {@code SetProperty} will be bound with {@code SetPropertiesRule} digester rule.
035 *
036 * @see org.apache.commons.digester3.Digester#addSetProperties(String,String[],String[])
037 * @since 2.1
038 */
039@Documented
040@Retention( RetentionPolicy.RUNTIME )
041@Target( ElementType.FIELD )
042@DigesterRule( reflectsRule = SetPropertiesRule.class, handledBy = SetPropertiesHandler.class )
043public @interface SetProperty
044{
045
046    /**
047     * The element matching pattern.
048     */
049    String pattern();
050
051    /**
052     * The namespace URI for which this Rule is relevant, if any.
053     *
054     * @since 3.0
055     */
056    String namespaceURI() default "";
057
058    /**
059     * The overridden parameter.
060     */
061    String attributeName() default "";
062
063    /**
064     * Defines several {@code @SetProperty} annotations on the same element.
065     *
066     * @see SetProperty
067     */
068    @Documented
069    @Retention( RetentionPolicy.RUNTIME )
070    @Target( ElementType.FIELD )
071    @DigesterRuleList
072    @interface List
073    {
074        SetProperty[] value();
075    }
076
077}