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.*;
021import org.apache.juneau.json.*;
022import org.apache.juneau.parser.*;
023import org.apache.juneau.rest.*;
024import org.apache.juneau.rest.annotation.*;
025import org.apache.juneau.serializer.*;
026import org.apache.juneau.transform.*;
027import org.apache.juneau.xml.*;
028
029/**
030 * Annotations applicable to subclasses of {@link BaseProvider}.
031 *
032 * <h5 class='topic'>Description</h5>
033 *
034 * Used to associate serializers, parsers, filters, and properties with instances of {@link BaseProvider}.
035 *
036 * <h5 class='section'>See Also:</h5>
037 * <ul>
038 *    <li class='link'>{@doc juneau-rest-server-jaxrs}
039 * </ul>
040 */
041@Documented
042@Target(TYPE)
043@Retention(RUNTIME)
044@Inherited
045public @interface JuneauProvider {
046
047   /**
048    * Provider-level bean filters.
049    *
050    * <p>
051    * These filters are applied to all serializers and parsers being used by the provider.
052    *
053    * <p>
054    * If the specified class is an instance of {@link BeanFilterBuilder}, then a filter built from that builder is added.
055    * Any other classes are wrapped in a {@link InterfaceBeanFilterBuilder} to indicate that subclasses should
056    * be treated as the specified class type.
057    */
058   Class<?>[] beanFilters() default {};
059
060   /**
061    * Provider-level POJO swaps.
062    *
063    * <p>
064    * These POJO swaps are applied to all serializers and parsers being used by the provider.
065    *
066    * <p>
067    * If the specified class is an instance of {@link PojoSwap}, then that swap is added.
068    * Any other classes are wrapped in a {@link SurrogateSwap}.
069    */
070   Class<?>[] pojoSwaps() default {};
071
072   /**
073    * Provider-level properties.
074    *
075    * <p>
076    * Any of the following property names can be specified:
077    * <ul>
078    *    <li>{@link RestContext}
079    *    <li>{@link BeanContext}
080    *    <li>{@link Serializer}
081    *    <li>{@link Parser}
082    *    <li>{@link JsonSerializer}
083    *    <li>{@link XmlSerializer}
084    *    <li>{@link XmlParser}
085    * </ul>
086    *
087    * <p>
088    * Property values will be converted to the appropriate type.
089    *
090    * <p>
091    * These properties can be augmented/overridden through the {@link RestMethod#properties() @RestMethod(properties)} annotation on the REST method.
092    */
093   Property[] properties() default {};
094
095   /**
096    * Shortcut for setting {@link #properties()} of boolean types.
097    *
098    * <p>
099    * Setting a flag is the equivalent to setting the same property to <js>"true"</js>.
100    */
101   String[] flags() default {};
102
103   /**
104    * Specifies a list of {@link Serializer} classes to add to the list of serializers available for this provider.
105    *
106    * <p>
107    * This annotation can only be used on {@link Serializer} classes that have no-arg constructors.
108    */
109   Class<? extends Serializer>[] serializers() default {};
110
111   /**
112    * Specifies a list of {@link Parser} classes to add to the list of parsers available for this provider.
113    *
114    * <p>
115    * This annotation can only be used on {@link Parser} classes that have no-arg constructors.
116    */
117   Class<? extends Parser>[] parsers() default {};
118}