001 package com.sptci.prevayler.annotations;
002
003 import java.lang.annotation.Documented;
004 import java.lang.annotation.ElementType;
005 import java.lang.annotation.Inherited;
006 import java.lang.annotation.Retention;
007 import java.lang.annotation.RetentionPolicy;
008 import java.lang.annotation.Target;
009
010 /**
011 * Annotation used to indicate that a field in a prevalent object is to be
012 * indexed. Note that this annotation is meant for indexing fields that are
013 * not references to other prevalent object(s). Use {@link ForeignKey} for
014 * fields that are references to other prevalent objects.
015 *
016 * <p>© Copyright 2008 <a href='http://sptci.com/' target='_top'>Sans Pareil Technologies, Inc.</a></p>
017 * @author Rakesh Vidyadharan 2008-05-22
018 * @version $Id: Index.java 11 2008-06-30 21:33:41Z sptrakesh $
019 */
020 @Documented
021 @Inherited
022 @Retention( RetentionPolicy.RUNTIME )
023 @Target( { ElementType.TYPE, ElementType.FIELD } )
024 public @interface Index
025 {
026 /** The default value for {@link #members} indicating a null value. */
027 static String NULL = "";
028
029 /**
030 * The name of the fields in the prevalent object to index. This need only
031 * be specified when specified at the class level. Multiple fields may be
032 * specified to indicate a composite index. Defaults to {@link #NULL}.
033 *
034 * @return The name of the fields.
035 */
036 String[] members() default NULL;
037
038 /**
039 * An optional flag used to indicate that the index represents a unique
040 * index. Defaults to <code>false</code>.
041 *
042 * @return The flag indicating whether the index is unique or not.
043 */
044 boolean unique() default false;
045 }