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.plaintext.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020import org.apache.juneau.plaintext.*;
021
022/**
023 * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link PlainTextSerializer} and {@link PlainTextParser}.
024 *
025 * <ul class='seealso'>
026 * </ul>
027 */
028@Documented
029@Target({TYPE,FIELD,METHOD})
030@Retention(RUNTIME)
031@Inherited
032public @interface PlainText {
033
034   /**
035    * Dynamically apply this annotation to the specified classes/methods/fields.
036    *
037    * <p>
038    * Used in conjunction with the {@link PlainTextConfig#applyPlainText()}.
039    * It is ignored when the annotation is applied directly to classes/methods/fields.
040    *
041    * <h5 class='section'>Valid patterns:</h5>
042    * <ul class='spaced-list'>
043    *  <li>Classes:
044    *       <ul>
045    *          <li>Fully qualified:
046    *             <ul>
047    *                <li><js>"com.foo.MyClass"</js>
048    *             </ul>
049    *          <li>Fully qualified inner class:
050    *             <ul>
051    *                <li><js>"com.foo.MyClass$Inner1$Inner2"</js>
052    *             </ul>
053    *          <li>Simple:
054    *             <ul>
055    *                <li><js>"MyClass"</js>
056    *             </ul>
057    *          <li>Simple inner:
058    *             <ul>
059    *                <li><js>"MyClass$Inner1$Inner2"</js>
060    *                <li><js>"Inner1$Inner2"</js>
061    *                <li><js>"Inner2"</js>
062    *             </ul>
063    *       </ul>
064    *    <li>Methods:
065    *       <ul>
066    *          <li>Fully qualified with args:
067    *             <ul>
068    *                <li><js>"com.foo.MyClass.myMethod(String,int)"</js>
069    *                <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js>
070    *                <li><js>"com.foo.MyClass.myMethod()"</js>
071    *             </ul>
072    *          <li>Fully qualified:
073    *             <ul>
074    *                <li><js>"com.foo.MyClass.myMethod"</js>
075    *             </ul>
076    *          <li>Simple with args:
077    *             <ul>
078    *                <li><js>"MyClass.myMethod(String,int)"</js>
079    *                <li><js>"MyClass.myMethod(java.lang.String,int)"</js>
080    *                <li><js>"MyClass.myMethod()"</js>
081    *             </ul>
082    *          <li>Simple:
083    *             <ul>
084    *                <li><js>"MyClass.myMethod"</js>
085    *             </ul>
086    *          <li>Simple inner class:
087    *             <ul>
088    *                <li><js>"MyClass$Inner1$Inner2.myMethod"</js>
089    *                <li><js>"Inner1$Inner2.myMethod"</js>
090    *                <li><js>"Inner2.myMethod"</js>
091    *             </ul>
092    *       </ul>
093    *    <li>Fields:
094    *       <ul>
095    *          <li>Fully qualified:
096    *             <ul>
097    *                <li><js>"com.foo.MyClass.myField"</js>
098    *             </ul>
099    *          <li>Simple:
100    *             <ul>
101    *                <li><js>"MyClass.myField"</js>
102    *             </ul>
103    *          <li>Simple inner class:
104    *             <ul>
105    *                <li><js>"MyClass$Inner1$Inner2.myField"</js>
106    *                <li><js>"Inner1$Inner2.myField"</js>
107    *                <li><js>"Inner2.myField"</js>
108    *             </ul>
109    *       </ul>
110    *    <li>A comma-delimited list of anything on this list.
111    * </ul>
112    *
113    * <ul class='seealso'>
114    *    <li class='link'>{@doc DynamicallyAppliedAnnotations}
115    * </ul>
116    */
117   String on() default "";
118}