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 * Identifies a setter as a method for adding a parent reference to a child object. 022 * 023 * <p> 024 * Used by the parsers to add references to parent objects in child objects. 025 * 026 * <ul class='notes'> 027 * <li> 028 * The annotated field or method does not need to be public. 029 * </ul> 030 * 031 * <ul class='seealso'> 032 * <li class='link'>{@doc juneau-marshall.Transforms.NamePropertyAnnotation} 033 * </ul> 034 */ 035@Target({METHOD,FIELD}) 036@Retention(RUNTIME) 037@Inherited 038public @interface ParentProperty { 039 040 /** 041 * Dynamically apply this annotation to the specified methods/fields. 042 * 043 * <p> 044 * Used in conjunction with the {@link BeanConfig#applyParentProperty()}. 045 * It is ignored when the annotation is applied directly to methods/fields. 046 * 047 * <h5 class='section'>Valid patterns:</h5> 048 * <ul class='spaced-list'> 049 * <li>Methods: 050 * <ul> 051 * <li>Fully qualified with args: 052 * <ul> 053 * <li><js>"com.foo.MyClass.myMethod(String,int)"</js> 054 * <li><js>"com.foo.MyClass.myMethod(java.lang.String,int)"</js> 055 * <li><js>"com.foo.MyClass.myMethod()"</js> 056 * </ul> 057 * <li>Fully qualified: 058 * <ul> 059 * <li><js>"com.foo.MyClass.myMethod"</js> 060 * </ul> 061 * <li>Simple with args: 062 * <ul> 063 * <li><js>"MyClass.myMethod(String,int)"</js> 064 * <li><js>"MyClass.myMethod(java.lang.String,int)"</js> 065 * <li><js>"MyClass.myMethod()"</js> 066 * </ul> 067 * <li>Simple: 068 * <ul> 069 * <li><js>"MyClass.myMethod"</js> 070 * </ul> 071 * <li>Simple inner class: 072 * <ul> 073 * <li><js>"MyClass$Inner1$Inner2.myMethod"</js> 074 * <li><js>"Inner1$Inner2.myMethod"</js> 075 * <li><js>"Inner2.myMethod"</js> 076 * </ul> 077 * </ul> 078 * <li>Fields: 079 * <ul> 080 * <li>Fully qualified: 081 * <ul> 082 * <li><js>"com.foo.MyClass.myField"</js> 083 * </ul> 084 * <li>Simple: 085 * <ul> 086 * <li><js>"MyClass.myField"</js> 087 * </ul> 088 * <li>Simple inner class: 089 * <ul> 090 * <li><js>"MyClass$Inner1$Inner2.myField"</js> 091 * <li><js>"Inner1$Inner2.myField"</js> 092 * <li><js>"Inner2.myField"</js> 093 * </ul> 094 * </ul> 095 * <li>A comma-delimited list of anything on this list. 096 * </ul> 097 * 098 * <ul class='seealso'> 099 * <li class='link'>{@doc juneau-marshall.DynamicallyAppliedAnnotations} 100 * </ul> 101 */ 102 String on() default ""; 103}