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 * Used to identify a class or bean property as a URI.
022 *
023 * <p>
024 * This annotation allows you to identify other classes that return URIs via <c>toString()</c> as URI objects.
025 *
026 * <ul class='seealso'>
027 *    <li class='link'>{@doc MarshallingUris}
028 * </ul>
029 */
030@Documented
031@Target({TYPE,FIELD,METHOD})
032@Retention(RUNTIME)
033@Inherited
034public @interface URI {
035
036   /**
037    * Dynamically apply this annotation to the specified class/method/fields.
038    *
039    * <p>
040    * Used in conjunction with the {@link BeanConfig#applyURI()}.
041    * It is ignored when the annotation is applied directly to class/method/fields.
042    *
043    * <h5 class='section'>Valid patterns:</h5>
044    * <ul class='spaced-list'>
045    *  <li>Classes:
046    *       <ul>
047    *          <li>Fully qualified:
048    *             <ul>
049    *                <li><js>"com.foo.MyClass"</js>
050    *             </ul>
051    *          <li>Fully qualified inner class:
052    *             <ul>
053    *                <li><js>"com.foo.MyClass$Inner1$Inner2"</js>
054    *             </ul>
055    *          <li>Simple:
056    *             <ul>
057    *                <li><js>"MyClass"</js>
058    *             </ul>
059    *          <li>Simple inner:
060    *             <ul>
061    *                <li><js>"MyClass$Inner1$Inner2"</js>
062    *                <li><js>"Inner1$Inner2"</js>
063    *                <li><js>"Inner2"</js>
064    *             </ul>
065    *       </ul>
066    *    <li>Methods:
067    *       <ul>
068    *          <li>Fully qualified with args:
069    *             <ul>
070    *                <li><js>"com.foo.MyClass.myMethod(String,int)"</js>
071    *                <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js>
072    *                <li><js>"com.foo.MyClass.myMethod()"</js>
073    *             </ul>
074    *          <li>Fully qualified:
075    *             <ul>
076    *                <li><js>"com.foo.MyClass.myMethod"</js>
077    *             </ul>
078    *          <li>Simple with args:
079    *             <ul>
080    *                <li><js>"MyClass.myMethod(String,int)"</js>
081    *                <li><js>"MyClass.myMethod(java.lang.String,int)"</js>
082    *                <li><js>"MyClass.myMethod()"</js>
083    *             </ul>
084    *          <li>Simple:
085    *             <ul>
086    *                <li><js>"MyClass.myMethod"</js>
087    *             </ul>
088    *          <li>Simple inner class:
089    *             <ul>
090    *                <li><js>"MyClass$Inner1$Inner2.myMethod"</js>
091    *                <li><js>"Inner1$Inner2.myMethod"</js>
092    *                <li><js>"Inner2.myMethod"</js>
093    *             </ul>
094    *       </ul>
095    *    <li>Fields:
096    *       <ul>
097    *          <li>Fully qualified:
098    *             <ul>
099    *                <li><js>"com.foo.MyClass.myField"</js>
100    *             </ul>
101    *          <li>Simple:
102    *             <ul>
103    *                <li><js>"MyClass.myField"</js>
104    *             </ul>
105    *          <li>Simple inner class:
106    *             <ul>
107    *                <li><js>"MyClass$Inner1$Inner2.myField"</js>
108    *                <li><js>"Inner1$Inner2.myField"</js>
109    *                <li><js>"Inner2.myField"</js>
110    *             </ul>
111    *       </ul>
112    *    <li>A comma-delimited list of anything on this list.
113    * </ul>
114    *
115    * <ul class='seealso'>
116    *    <li class='link'>{@doc DynamicallyAppliedAnnotations}
117    * </ul>
118    */
119   String on() default "";
120}