001 package org.tynamo.descriptor.annotation;
002
003 import org.tynamo.descriptor.annotation.handlers.HandledBy;
004 import org.tynamo.descriptor.annotation.handlers.PossibleValuesAnnotationHandler;
005
006 import java.lang.annotation.ElementType;
007 import java.lang.annotation.Retention;
008 import java.lang.annotation.RetentionPolicy;
009 import java.lang.annotation.Target;
010
011 /**
012 * Annotation used to declare filter options from a select based on
013 * other property.
014 * <p/>
015 * The most common example of this is selecting a State based on the value of
016 * the country property. If the property you want to filter by is named
017 * "countryFilter" and the Country class has a property named "states" you
018 * should annotate the state property in this way:<br>
019 *
020 * @author pruggia
021 * @PossibleValues("countryFilter.states")<br> <br>
022 * Don't forget to add a {@link InitialValue} to the filtering
023 * property.
024 */
025 @Retention(RetentionPolicy.RUNTIME)
026 @Target({ElementType.FIELD, ElementType.METHOD})
027 @HandledBy(PossibleValuesAnnotationHandler.class)
028 public @interface PossibleValues
029 {
030
031 /**
032 * The expression that when executed provides the options to select values
033 * from.
034 */
035 String value();
036 }
037