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