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.annotation; 014 015import static java.lang.annotation.ElementType.*; 016import static java.lang.annotation.RetentionPolicy.*; 017 018import java.lang.annotation.*; 019 020/** 021 * Ignore classes, fields, and methods from being interpreted as bean or bean components. 022 * 023 * <p> 024 * Can be used in the following locations: 025 * <ul> 026 * <li>Classes - Forces bean-like classes to be treated as non-beans. 027 * <li>Methods - Forces getters/setters to be ignored. 028 * <li>Fields - Forces bean fields to be ignored. 029 * <li><ja>@Rest</ja>-annotated classes and <ja>@RestOp</ja>-annotated methods when an {@link #on()} value is specified. 030 * </ul> 031 * 032 * <h5 class='section'>See Also:</h5><ul> 033 * <li class='link'><a class="doclink" href="../../../../index.html#jm.BeanIgnoreAnnotation">@BeanIgnore Annotation</a> 034 035 * </ul> 036 */ 037@Documented 038@Target({FIELD,METHOD,TYPE,CONSTRUCTOR}) 039@Retention(RUNTIME) 040@Inherited 041@Repeatable(BeanIgnoreAnnotation.Array.class) 042@ContextApply(BeanIgnoreAnnotation.Applier.class) 043public @interface BeanIgnore { 044 /** 045 * Dynamically apply this annotation to the specified classes/methods/fields/constructors. 046 * 047 * <p> 048 * Used in conjunction with {@link org.apache.juneau.BeanContext.Builder#applyAnnotations(Class...)} to dynamically apply an annotation to an existing class/method/field/constructor. 049 * It is ignored when the annotation is applied directly to classes/methods/fields/constructors. 050 * 051 * <h5 class='section'>Valid patterns:</h5> 052 * <ul class='spaced-list'> 053 * <li>Classes: 054 * <ul> 055 * <li>Fully qualified: 056 * <ul> 057 * <li><js>"com.foo.MyClass"</js> 058 * </ul> 059 * <li>Fully qualified inner class: 060 * <ul> 061 * <li><js>"com.foo.MyClass$Inner1$Inner2"</js> 062 * </ul> 063 * <li>Simple: 064 * <ul> 065 * <li><js>"MyClass"</js> 066 * </ul> 067 * <li>Simple inner: 068 * <ul> 069 * <li><js>"MyClass$Inner1$Inner2"</js> 070 * <li><js>"Inner1$Inner2"</js> 071 * <li><js>"Inner2"</js> 072 * </ul> 073 * </ul> 074 * <li>Methods: 075 * <ul> 076 * <li>Fully qualified with args: 077 * <ul> 078 * <li><js>"com.foo.MyClass.myMethod(String,int)"</js> 079 * <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> 080 * <li><js>"com.foo.MyClass.myMethod()"</js> 081 * </ul> 082 * <li>Fully qualified: 083 * <ul> 084 * <li><js>"com.foo.MyClass.myMethod"</js> 085 * </ul> 086 * <li>Simple with args: 087 * <ul> 088 * <li><js>"MyClass.myMethod(String,int)"</js> 089 * <li><js>"MyClass.myMethod(java.lang.String,int)"</js> 090 * <li><js>"MyClass.myMethod()"</js> 091 * </ul> 092 * <li>Simple: 093 * <ul> 094 * <li><js>"MyClass.myMethod"</js> 095 * </ul> 096 * <li>Simple inner class: 097 * <ul> 098 * <li><js>"MyClass$Inner1$Inner2.myMethod"</js> 099 * <li><js>"Inner1$Inner2.myMethod"</js> 100 * <li><js>"Inner2.myMethod"</js> 101 * </ul> 102 * </ul> 103 * <li>Fields: 104 * <ul> 105 * <li>Fully qualified: 106 * <ul> 107 * <li><js>"com.foo.MyClass.myField"</js> 108 * </ul> 109 * <li>Simple: 110 * <ul> 111 * <li><js>"MyClass.myField"</js> 112 * </ul> 113 * <li>Simple inner class: 114 * <ul> 115 * <li><js>"MyClass$Inner1$Inner2.myField"</js> 116 * <li><js>"Inner1$Inner2.myField"</js> 117 * <li><js>"Inner2.myField"</js> 118 * </ul> 119 * </ul> 120 * <li>Constructors: 121 * <ul> 122 * <li>Fully qualified with args: 123 * <ul> 124 * <li><js>"com.foo.MyClass(String,int)"</js> 125 * <li><js>"com.foo.MyClass(java.lang.String,int)"</js> 126 * <li><js>"com.foo.MyClass()"</js> 127 * </ul> 128 * <li>Simple with args: 129 * <ul> 130 * <li><js>"MyClass(String,int)"</js> 131 * <li><js>"MyClass(java.lang.String,int)"</js> 132 * <li><js>"MyClass()"</js> 133 * </ul> 134 * <li>Simple inner class: 135 * <ul> 136 * <li><js>"MyClass$Inner1$Inner2()"</js> 137 * <li><js>"Inner1$Inner2()"</js> 138 * <li><js>"Inner2()"</js> 139 * </ul> 140 * </ul> 141 * <li>A comma-delimited list of anything on this list. 142 * </ul> 143 * 144 * <h5 class='section'>See Also:</h5><ul> 145 * <li class='link'><a class="doclink" href="../../../../index.html#jm.DynamicallyAppliedAnnotations">Dynamically Applied Annotations</a> 146 * </ul> 147 * 148 * @return The annotation value. 149 */ 150 String[] on() default {}; 151 152 /** 153 * Dynamically apply this annotation to the specified classes. 154 * 155 * <p> 156 * Identical to {@link #on()} except allows you to specify class objects instead of a strings. 157 * 158 * <h5 class='section'>See Also:</h5><ul> 159 * <li class='link'><a class="doclink" href="../../../../index.html#jm.DynamicallyAppliedAnnotations">Dynamically Applied Annotations</a> 160 * </ul> 161 * 162 * @return The annotation value. 163 */ 164 Class<?>[] onClass() default {}; 165} 166