001package io.ebean.annotation;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Repeatable;
005import java.lang.annotation.Retention;
006import java.lang.annotation.RetentionPolicy;
007import java.lang.annotation.Target;
008
009/**
010 * An annotation for declaring an index.
011 *
012 * @author rvbiljouw
013 */
014@Target({ElementType.TYPE, ElementType.FIELD})
015@Retention(RetentionPolicy.RUNTIME)
016@Repeatable(Indices.class)
017public @interface Index {
018
019  /**
020   * Name of the index. If left blank a name is derived using the built in naming convention.
021   */
022  String name() default "";
023
024  /**
025   * If set true indicates this is a unique index.
026   */
027  boolean unique() default false;
028
029  /**
030   * When placed on the class (rather than field) you can specify the columns
031   * to include in the index in order.
032   * <p>
033   * When placed on a field, and columnNames are specified, the field-column has to be included.
034   * You can use "${fa}" for alias.
035   */
036  String[] columnNames() default {};
037
038}