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