1 /* 2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.properties.api.core.annotations; 17 18 import java.lang.annotation.Documented; 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.lang.annotation.Target; 23 24 /** 25 * Declares a method to return meta data instead of a property value. 26 * <p> 27 * Per default methods with a name ending with <tt>PropertyDescriptor</tt> or 28 * <tt>PropertyKey</tt> return the 29 * {@link de.smartics.properties.api.core.domain.PropertyDescriptor} or 30 * {@link de.smartics.properties.api.core.PropertyKey} instead of the 31 * property value. If this naming convention should not be used, this annotation 32 * allows to explicitly specify the property whose meta data is requested. 33 * </p> 34 */ 35 @Documented 36 @Target(ElementType.METHOD) 37 @Retention(RetentionPolicy.RUNTIME) 38 public @interface PropertyMetaDataMethod 39 { 40 /** 41 * The default suffix of a name of a method that returns the descriptor of a 42 * property. 43 * <p> 44 * The value of the constant is {@value}. 45 * </p> 46 */ 47 String PROPERTY_DESCRIPTOR = "PropertyDescriptor"; // NOPMD 48 49 /** 50 * The default suffix of a name of a method that returns the key of a 51 * property. 52 * <p> 53 * The value of the constant is {@value}. 54 * </p> 55 */ 56 String PROPERTY_KEY = "PropertyKey"; // NOPMD 57 58 /** 59 * The name of the property the annotated method returns meta data for. The 60 * type of meta data is determined by the return type of the method. 61 */ 62 String value(); 63 }