001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.jaxrs;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020import org.apache.juneau.parser.*;
021import org.apache.juneau.rest.annotation.*;
022import org.apache.juneau.serializer.*;
023import org.apache.juneau.transform.*;
024
025/**
026 * Annotations applicable to subclasses of {@link BaseProvider}.
027 *
028 * <h5 class='topic'>Description</h5>
029 *
030 * Used to associate serializers, parsers, filters, and properties with instances of {@link BaseProvider}.
031 *
032 * <ul class='seealso'>
033 *    <li class='link'>{@doc juneau-rest-server-jaxrs}
034 * </ul>
035 */
036@Documented
037@Target(TYPE)
038@Retention(RUNTIME)
039@Inherited
040public @interface JuneauProvider {
041
042   /**
043    * Provider-level bean filters.
044    *
045    * <p>
046    * These filters are applied to all serializers and parsers being used by the provider.
047    *
048    * <p>
049    * If the specified class is an instance of {@link BeanFilterBuilder}, then a filter built from that builder is added.
050    * Any other classes are wrapped in a {@link InterfaceBeanFilterBuilder} to indicate that subclasses should
051    * be treated as the specified class type.
052    */
053   Class<?>[] beanFilters() default {};
054
055   /**
056    * Provider-level POJO swaps.
057    *
058    * <p>
059    * These POJO swaps are applied to all serializers and parsers being used by the provider.
060    *
061    * <p>
062    * If the specified class is an instance of {@link PojoSwap}, then that swap is added.
063    * Any other classes are wrapped in a {@link SurrogateSwap}.
064    */
065   Class<?>[] pojoSwaps() default {};
066
067   /**
068    * Provider-level properties.
069    *
070    * <p>
071    * Property values will be converted to the appropriate type.
072    *
073    * <p>
074    * These properties can be augmented/overridden through the {@link RestMethod#properties() @RestMethod(properties)} annotation on the REST method.
075    */
076   Property[] properties() default {};
077
078   /**
079    * Shortcut for setting {@link #properties()} of boolean types.
080    *
081    * <p>
082    * Setting a flag is the equivalent to setting the same property to <js>"true"</js>.
083    */
084   String[] flags() default {};
085
086   /**
087    * Specifies a list of {@link Serializer} classes to add to the list of serializers available for this provider.
088    *
089    * <p>
090    * This annotation can only be used on {@link Serializer} classes that have no-arg constructors.
091    */
092   Class<? extends Serializer>[] serializers() default {};
093
094   /**
095    * Specifies a list of {@link Parser} classes to add to the list of parsers available for this provider.
096    *
097    * <p>
098    * This annotation can only be used on {@link Parser} classes that have no-arg constructors.
099    */
100   Class<? extends Parser>[] parsers() default {};
101}