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 * @deprecated Use {@link #swaps()} 059 */ 060 @Deprecated 061 Class<?>[] pojoSwaps() default {}; 062 063 /** 064 * Provider-level properties. 065 * 066 * <p> 067 * Property values will be converted to the appropriate type. 068 * 069 * <p> 070 * These properties can be augmented/overridden through the {@link RestMethod#properties() @RestMethod(properties)} annotation on the REST method. 071 */ 072 Property[] properties() default {}; 073 074 /** 075 * Provider-level POJO swaps. 076 * 077 * <p> 078 * These POJO swaps are applied to all serializers and parsers being used by the provider. 079 * 080 * <p> 081 * If the specified class is an instance of {@link PojoSwap}, then that swap is added. 082 * Any other classes are wrapped in a {@link SurrogateSwap}. 083 */ 084 Class<?>[] swaps() default {}; 085 086 /** 087 * Shortcut for setting {@link #properties()} of boolean types. 088 * 089 * <p> 090 * Setting a flag is the equivalent to setting the same property to <js>"true"</js>. 091 */ 092 String[] flags() default {}; 093 094 /** 095 * Specifies a list of {@link Serializer} classes to add to the list of serializers available for this provider. 096 * 097 * <p> 098 * This annotation can only be used on {@link Serializer} classes that have no-arg constructors. 099 */ 100 Class<? extends Serializer>[] serializers() default {}; 101 102 /** 103 * Specifies a list of {@link Parser} classes to add to the list of parsers available for this provider. 104 * 105 * <p> 106 * This annotation can only be used on {@link Parser} classes that have no-arg constructors. 107 */ 108 Class<? extends Parser>[] parsers() default {}; 109}