001 package org.tynamo.descriptor.annotation;
002
003 import java.lang.annotation.ElementType;
004 import java.lang.annotation.Retention;
005 import java.lang.annotation.RetentionPolicy;
006 import java.lang.annotation.Target;
007
008 /**
009 * Annotation used to initialize a field based on an OGNL expression, usually
010 * another field.
011 * <p/>
012 * For example, assume you have a car of certain model made by certain make.
013 * The car has a relation to the model, but not the make. So you create a
014 * transient property make initialized by model.make.<br>
015 *
016 * @author pruggia
017 * @InitialValue("model.make")<br> This expression is only evaluated when editing the entity.
018 * <p/>
019 * See also {@link PossibleValues}.
020 */
021 @Retention(RetentionPolicy.RUNTIME)
022 @Target({ElementType.FIELD, ElementType.METHOD})
023 @DescriptorAnnotation(InitialValueAnnotationHandler.class)
024 public @interface InitialValue
025 {
026
027 /**
028 * The expression that when executed provides the initial value for the
029 * property.
030 */
031 String value();
032 }
033